Skip to content

Instantly share code, notes, and snippets.

View ziggi's full-sized avatar
🏠
Working from home

Sergei Marochkin ziggi

🏠
Working from home
View GitHub Profile
@ziggi
ziggi / orgsys.pwn
Last active October 11, 2017 07:54
Organization System
#include <a_samp>
#define ORGANIZATION_MAX_NAME 32
#define ORGANIZATION_MAX_RANK_NAME 32
enum {
ORGANIZATION_NONE,
ORGANIZATION_LSPD,
ORGANIZATION_FBI,
ORGANIZATION_AVIA,
@ziggi
ziggi / fix_getvpcd.pwn
Created November 23, 2015 14:32
GetVehicleParamsCarDoors fix (beta)
/*
About: GetVehicleParamsCarDoors fix (beta)
Author: ziggi
*/
#if !defined _samp_included
#error Include a_samp.inc first
#endif
@ziggi
ziggi / cmd_id.pwn
Last active April 9, 2017 21:05
/id <part of nickname>
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)) {
@ziggi
ziggi / GetWeekName.pwn
Last active January 27, 2016 07:36
return week name by date
enum WeekLang {
WEEK_LANG_ENGLISH,
WEEK_LANG_RUSSIAN,
}
static const
gDaysOfWeek[WeekLang][][] = {
{
!"Thursday",
!"Friday",
@ziggi
ziggi / example.php
Last active December 23, 2015 14:59
Usage arrays with OOP
<?php
inculde 'oop_config.php';
echo Config::get()->site->path;
// result: some_path/
$cfg = new Config;
echo $cfg->site->path;
// result: some_path/
#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;
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)
@ziggi
ziggi / GetCoordsBefore.pwn
Last active August 29, 2015 14:20
GetCoordsBefore functions collection
stock GetCoordsBefore(Float:x, Float:y, Float:a, Float:distance, &Float:res_x, &Float:res_y)
{
res_x = x + (distance * floatsin(-a, degrees));
res_y = y + (distance * floatcos(-a, degrees));
}
stock ReturnRandomSymbol(bool:uppercase = true, bool:lowercase = true)
{
new value = -1;
if (uppercase && lowercase) {
value = random(2);
}
if (uppercase && (value == 0 || value == -1)) {
value = mathrandom('A', 'Z');
@ziggi
ziggi / crop_str.pwn
Created April 24, 2015 09:49
Crop string
stock crop_string(const input_str[], output_str[], const length = 60, const size = sizeof(output_str))
{
new
buffer[1024],
i = 0,
j = 0;
while (input_str[i] != '\0') {
if (i % length == 0) {
buffer[j] = '\n';