Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Sergei Marochkin ziggi

🏠
Working from home
Block or report user

Report or block ziggi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rgba2bgra.pwn
stock rgba2bgra(color)
{
return
(color & 0xFF)
| ((color & 0xFF00) << 16)
| (color & 0xFF0000)
| ((color >> 16) & 0xFF00);
}
@ziggi
ziggi / cmd_id.pwn
Last active Apr 9, 2017
/id <part of nickname>
View cmd_id.pwn
CMD:id(playerid, params[])
{
#if !defined COMMAND_ID_MAX_MATCHES
#define COMMAND_ID_MAX_MATCHES 10
#endif
new
ids[COMMAND_ID_MAX_MATCHES];
if (sscanf(params, "?<MATCH_NAME_PARTIAL=1>u[" #COMMAND_ID_MAX_MATCHES "]", ids)) {
View frandom.pwn
stock Float:frandom(Float:max)
{
return floatdiv(float(random(0)), floatdiv(float(cellmax), max));
}
@ziggi
ziggi / GetTickDiff.pwn
Last active Aug 15, 2019
Function to calculate the time elapsed between the two calls GetTickCount(), given the possibility of overflow passed values.
View GetTickDiff.pwn
stock GetTickDiff(newtick, oldtick)
{
if (oldtick > newtick) {
return (cellmax - oldtick + 1) - (cellmin - newtick);
}
return newtick - oldtick;
}
@ziggi
ziggi / proxdetector.pwn
Last active Oct 1, 2018
SA-MP ProxDetector function
View proxdetector.pwn
stock ProxDetector(playerid, Float:max_range, color, const string[], Float:max_ratio = 1.6)
{
new
Float:pos_x,
Float:pos_y,
Float:pos_z,
Float:range,
Float:range_ratio,
Float:range_with_ratio,
clr_r, clr_g, clr_b,
@ziggi
ziggi / fix_getvpcd.pwn
Created Nov 23, 2015
GetVehicleParamsCarDoors fix (beta)
View fix_getvpcd.pwn
/*
About: GetVehicleParamsCarDoors fix (beta)
Author: ziggi
*/
#if !defined _samp_included
#error Include a_samp.inc first
#endif
View remove_spaces.pwn
#include <a_samp>
/*
Consts
*/
#define TESTING_STRING " oc, ococ,ococ,ococ,oc oc,ococ,ococ,ococ,ococ,ococ,oco"
#define RESULT_STRING "oc,ococ,ococ,ococ,ococ,ococ,ococ,ococ,ococ,ococ,oco"
const PROFILE_ITERATIONS_MAJOR = 1000;
@ziggi
ziggi / bmp_read.cpp
Last active Apr 15, 2019
bmp reader
View bmp_read.cpp
#include <iostream>
#include <fstream>
#include "main.h"
int main(int argc, char *argv[])
{
if (argc < 2) {
std::cout << "Usage: " << argv[0] << " file_name" << std::endl;
return 0;
@ziggi
ziggi / .bashrc
Last active Jun 19, 2018
.bashrc
View .bashrc
# color aliases
alias sudo='sudo '
alias ls='ls --color=always'
alias dmesg='dmesg --color=always'
alias grep='grep --color=always'
alias gcc='gcc -fdiagnostics-color=always'
alias pacman='pacman --color=always'
alias dir='dir --color=always'
alias diff='diff --color=always'
View floatsuperround.pwn
stock Float:floatsuperround(Float:value, count)
{
new
Float:intpart = float(floatround(value, floatround_tozero)),
Float:fractpart = floatfract(value) * float(pow(10, floatfractlength(value)));
return intpart + fractpart / float(pow(10, count));
}
stock pow(value, degree)
You can’t perform that action at this time.