rendered paste body#include <a_samp>#include <a_mysql>#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1#define SCRIPT_NAME "Zion Roleplay"#define SCRIPT_VERSION "1.0a"#define SCRIPT_WRITER "Izanagi"#define MYSQL_HOST "127.0.0.1"#define MYSQL_USER "root"#define MYSQL_PASS "root"#define MYSQL_DB "zrp-db"native WP_Hash(buffer[], len, const str[]);/* Colors*/#define COLOR_GRAD1 0xB4B5B7FF#define COLOR_GRAD2 0xBFC0C2FF#define COLOR_GRAD3 0xCBCCCEFF#define COLOR_GRAD4 0xD8D8D8FF#define COLOR_GRAD5 0xE3E3E3FF#define COLOR_GRAD6 0xF0F0F0FF#define COLOR_GREY 0xAFAFAFAA#define COLOR_GREEN 0x33AA33AA#define COLOR_RED 0xAA3333AA#define COLOR_LIGHTRED 0xFF6347AA#define COLOR_LIGHTBLUE 0x33CCFFAA#define COLOR_LIGHTGREEN 0x9ACD32AA#define COLOR_LIGHTYELLOW 0xFAFFAFAA#define COLOR_YELLOW 0xFFFF00AA#define COLOR_YELLOW2 0xF5DEB3AA#define COLOR_WHITE 0xFFFFFFAA#define COLOR_MAGENTA 0xFF00FFFF#define COLOR_FADE1 0xE6E6E6E6#define COLOR_FADE2 0xC8C8C8C8#define COLOR_FADE3 0xAAAAAAAA#define COLOR_FADE4 0x8C8C8C8C#define COLOR_FADE5 0x6E6E6E6E#define COLOR_PURPLE 0xC2A2DAAA#define COLOR_DBLUE 0x2641FEAA#define COLOR_NEWS 0xFFA500AA#define COLOR_OOC 0xE0FFFFAA#define DUTY_ADMIN_COLOR 0x00808000#define COLOR_INVIS 0xAFAFAF00#define COLOR_SPEC 0xBFC0C200new realchat = 1;new BigEar[MAX_PLAYERS];new realtime = 1;new Text:InfoTD;new Logged [MAX_PLAYERS];new LoginTries [MAX_PLAYERS];new Registered [MAX_PLAYERS];new regStep [MAX_PLAYERS];enum accInfo{ pKey[64], pLevel, pAccessLevel, pDonateRank, pSex, pAge, pOrigin, pTan, pAccent, pCK, pMuted, pExp, pCash, pAccount, pCrimes, pKills, pDeaths, pArrested, pWantedDeaths, pPhoneBook, pJob, pPayCheck, pJailed, pJailOut[16], pMats, pDrugs, pFaction, pRank, pLocal, pPnumber, Float:pPos_x, Float:pPos_y, Float:pPos_z, pCarLic, pFlyLic, pBoatLic, pFishLic, pGunLic, pGunPrim, pGunSec, pAmmoPrim, pAmmoSec, pPayDayLeft, pPayDayHad, pTut, pWarns, pLastIP[24], pSQLID}new PlayerInfo[MAX_PLAYERS][accInfo];new SkinSlot[MAX_PLAYERS][3], SkinWearing[MAX_PLAYERS];new rand_skins[2][3] ={ {188, 223, 21}, {192, 193, 195}};new rand_swimwear[2][3] ={ {97, 45, 18}, {138, 140, 139}};main(){ printf(">> SCRIPT: Executing %s version %s by %s", SCRIPT_NAME, SCRIPT_VERSION, SCRIPT_WRITER);}public OnGameModeInit(){ SetGameModeText ( SCRIPT_NAME); mysql_connect ( MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS); if(realtime) { SetWorldTime(GetHour()); } InfoTD = TextDrawCreate (4.000000,435.000000,"~r~~h~~h~Zion Roleplay ~b~~h~zion-rp.hostei.com"); TextDrawFont (InfoTD, 0); TextDrawColor (InfoTD, 0xAA3333AA); TextDrawLetterSize (InfoTD, 0.6, 1.000000); TextDrawSetOutline (InfoTD, 1); TextDrawSetShadow (InfoTD, 1); TextDrawSetProportional (InfoTD, 1); TextDrawBackgroundColor (InfoTD, 0x00000033); AddPlayerClass(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); return 1;}public OnGameModeExit(){ return 1;}public OnPlayerRequestClass(playerid, classid){ return 1;}public OnPlayerRequestSpawn(playerid){ return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] You must login to spawn. If you are already authed and this happens please reconnect. ");}public OnPlayerConnect(playerid){ TextDrawHideForPlayer(playerid, InfoTD); TextDrawShowForPlayer(playerid, InfoTD); Logged [playerid] = 0; Registered [playerid] = 0; LoginTries [playerid] = 0; new query [128]; new q_name [ 24]; mysql_real_escape_string(PlayerName(playerid), q_name); format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `aName`='%s' LIMIT 1", q_name); mysql_store_result(); new rows = mysql_num_rows(); if(rows != 0) { Registered[playerid] = 1; mysql_free_result(); SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Welcome back. Please login to continue playing. "); return SendClientMessage(playerid, COLOR_LIGHTYELLOW, ">> /login <password>"); } else { Registered[playerid] = 0; mysql_free_result(); SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Account data not found. Please register. "); return SendClientMessage(playerid, COLOR_LIGHTYELLOW, ">> /register <e-mail> <password>"); }}public OnPlayerDisconnect(playerid, reason){ TextDrawHideForPlayer(playerid, InfoTD); return 1;}public OnPlayerSpawn(playerid){ if(!PlayerInfo[playerid][pTut]) { SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Welcome to Zion Roleplay. Please answer some questions about your character before you proceed on playing. "); SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] First of all, tell me. Are you a guy or a girl? \n('m' for male and 'f' for female) " ); regStep[playerid] = 1; } return 1;}public OnPlayerDeath(playerid, killerid, reason){ return 1;}public OnVehicleSpawn(vehicleid){ return 1;}public OnVehicleDeath(vehicleid, killerid){ return 1;}public OnPlayerText(playerid, text[]){ new string[128]; if (realchat) { if(Logged[playerid] == 0) { return 0; } if(regStep[playerid] == 1) { if(text[0] == 'm') { PlayerInfo[playerid][pSex] = 1; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you're a guy. What tan do you have? \n('l' for light, 'm' for medium, 'd' for dark tan) "); regStep[playerid] = 2; return 0; } if(text[0] == 'f') { PlayerInfo[playerid][pSex] = 2; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you're a girl. What tan do you have? \n('l' for light, 'm' for medium, 'd' for dark tan) "); regStep[playerid] = 2; return 0; } else return SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Are you a guy or a girl? \n('m' for male and 'f' for female) "); } else if(regStep[playerid] == 2) { if(text[0] == 'l') { PlayerInfo[playerid][pTan] = 1; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you're quite pale. How old are you? \n(Please type your age(16-72)"); SkinSlot[playerid][0] = rand_skins[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]]; SkinSlot[playerid][1] = rand_swimwear[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]]; regStep[playerid] = 3; return 0; } else if(text[0] == 'm') { PlayerInfo[playerid][pTan] = 2; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you're quite tanned. How old are you? \n(Please type your age(16-72)"); SkinSlot[playerid][0] = rand_skins[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]-1]; SkinSlot[playerid][1] = rand_swimwear[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]-1]; regStep[playerid] = 3; return 0; } else if(text[0] == 'd') { PlayerInfo[playerid][pTan] = 3; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so your skin is very dark. How old are you? \n(Please type your age(16-72)"); SkinSlot[playerid][0] = rand_skins[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]]; SkinSlot[playerid][1] = rand_swimwear[PlayerInfo[playerid][pSex]-1][PlayerInfo[playerid][pTan]]; regStep[playerid] = 3; return 0; } else { return SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] What tan do you have? \n('l' for light, 'm' for medium, 'd' for dark tan) "); } } else if(regStep[playerid] == 3) { if(strval(text) > 15 && strval(text) < 73) { PlayerInfo[playerid][pAge] = strval(text); format(string, sizeof(string), "* [SYSTEM] Ok, so you're %d years old. Where do you come from? \n([e]urope, [a]sia, [u]sa)", strval(text)); SendClientMessage(playerid, COLOR_WHITE, string); regStep[playerid] = 4; return 0; } else return SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] How old are you? \n(Please type your age(16-72) "); } else if(regStep[playerid] == 4) { if(text[0] =='e') { SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] So you're from Europe. Great. What's your accent? \n([i]talian, [a]merican, [b]ritish, [g]erman, [r]ussian, [j]apanese, [n]one) "); PlayerInfo[playerid][pOrigin] = 1; regStep[playerid] = 5; return 0; } if(text[0] == 'u') { SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] So you're from Europe. Great. What's your accent? \n([i]talian, [a]merican, [b]ritish, [g]erman, [r]ussian, [j]apanese, [n]one) "); PlayerInfo[playerid][pOrigin] = 2; regStep[playerid] = 5; return 0; } if(text[0] == 'a') { SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] So you're from Asia. Nice. What's your accent? \n([i]talian, [a]merican, [b]ritish, [g]erman, [r]ussian, [j]apanesen [n]one) "); PlayerInfo[playerid][pOrigin] = 3; regStep[playerid] = 5; return 0; } else return SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Where do you come from? \n([e]urope, [a]sia, [u]sa) "); } else if(regStep[playerid] == 5) { if(text[0] == 'i') { PlayerInfo[playerid][pAccent] = 1; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have an italian accent. Sounds sweet. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'a') { PlayerInfo[playerid][pAccent] = 2; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have an american accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'b') { PlayerInfo[playerid][pAccent] = 3; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have a british accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'g') { PlayerInfo[playerid][pAccent] = 4; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have a german accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'r') { PlayerInfo[playerid][pAccent] = 5; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have a russian accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'j') { PlayerInfo[playerid][pAccent] = 6; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you have a japanese accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } if(text[0] == 'n') { PlayerInfo[playerid][pAccent] = 0; SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] Ok, so you don't have an accent. \n >> Tutorial begins in 2 seconds"); SetTimerEx("TUT01", 2000, 0, "i", playerid); return 0; } else return SendClientMessage(playerid, COLOR_WHITE, "* [SYSTEM] What's your accent? \n([i]talian, [a]merican, [b]ritish, [g]erman, [r]ussian, [j]apanesen [n]one) "); } else if(PlayerInfo[playerid][pMuted]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "* [MUTE] Error. You may not speak. You have been muted"); new accentString[16]; switch (PlayerInfo[playerid][pAccent]) { case 0: format(string, sizeof(string), "%s: %s", PlayerName(playerid), text); case 1: { format(accentString, 16, "Italian"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } case 2: { format(accentString, 16, "American"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } case 3: { format(accentString, 16, "British"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } case 4: { format(accentString, 16, "German"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } case 5: { format(accentString, 16, "Russian"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } case 6: { format(accentString, 16, "Japanese"); format(string, sizeof(string), "[%s Accent] %s: %s", accentString, PlayerName(playerid), text); } } ProxDetector(20.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5); return 0; } return 1;}public OnPlayerPrivmsg(playerid, recieverid, text[]){ new string[128]; format(string, sizeof(string), "* [PM] To %s : %s", PlayerName(recieverid), text); SendClientMessage(playerid, COLOR_MAGENTA, string); format(string, sizeof(string), "* [PM] From %s : %s", PlayerName(playerid), text); SendClientMessage(recieverid, COLOR_MAGENTA, string); return 0;}public OnPlayerCommandText(playerid, cmdtext[]){ dcmd(register, 8, cmdtext ); dcmd(login, 5, cmdtext ); dcmd(me, 2, cmdtext ); dcmd(do, 2, cmdtext );// dcmd(bigear, 6, cmdtext ); return 0;}public OnPlayerInfoChange(playerid){ return 1;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){ return 1;}public OnPlayerExitVehicle(playerid, vehicleid){ return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){ return 1;}public OnPlayerEnterCheckpoint(playerid){ return 1;}public OnPlayerLeaveCheckpoint(playerid){ return 1;}public OnPlayerEnterRaceCheckpoint(playerid){ return 1;}public OnPlayerLeaveRaceCheckpoint(playerid){ return 1;}public OnRconCommand(cmd[]){ printf(cmd); return 1;}public OnObjectMoved(objectid){ return 1;}public OnPlayerObjectMoved(playerid, objectid){ return 1;}public OnPlayerPickUpPickup(playerid, pickupid){ return 1;}public OnPlayerSelectedMenuRow(playerid, row){ return 1;}public OnPlayerExitedMenu(playerid){ return 1;}/* Dcmd commands here*/dcmd_register(playerid, params[]){ new pass [24], email [32]; if(sscanf(params, "ss", pass, email)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Incorrect usage. Syntax: /register <e-mail> <password>"); if(strlen(pass) < 6 || strlen(pass) > 16) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Password must be between 6 and 16 symbols. "); if((strlen(email) < 8 || strlen(email) < 32)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. E-mail must be between 8 and 32 symbols. "); if(strfind(email, "@", true) > -1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Invalid E-mail. "); if(strfind(email, ".", true) > -1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Invalid E-mail. "); if(Logged[playerid]) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Already authed. "); if(Registered[playerid]) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Account already exists. Please login or reconnect using a diffrent name. "); new tmp[64]; WP_Hash(tmp, sizeof(tmp), pass); OnPlayerRegister(playerid, tmp, email); return 0;}dcmd_login(playerid, params[]){ new pass [24]; if(sscanf(params, "s", pass)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Incorrect usage. Syntax: /login <password>"); if(strlen(pass)<6 || strlen(pass) > 16) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Password must be between 6 and 16 symbols. "); if(Logged[playerid]) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Error. Already authed. "); new tmp[64]; WP_Hash(tmp, sizeof(tmp), pass); OnPlayerLogin(playerid, tmp) return 0;}dcmd_me(playerid, params[]){ new string[128]; format(string, sizeof(string), "* %s %s", PlayerName(playerid), params); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf("%s", string); return true;}dcmd_do(playerid, params[]){ new string[128]; format(string, sizeof(string), "* %s ((%s))", params, PlayerName(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); printf("%s", string); return true;}/* OnPlayerRegister and OnPlayerLogin bellow.*/forward OnPlayerRegister(playerid, pass[], email[]);public OnPlayerRegister (playerid, pass[], email[]){ new query [256]; mysql_check_connection(); format(query, sizeof(query), "INSERT INTO `accounts` VALUES `Name`='%s' , `Key`='%s' , `EMail`='%s'", PlayerName(playerid), pass, email); new q = mysql_query(query); if(q) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Registration Successful! You may now login. "); return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] Registration Failed... Please report the error if this continues. ");}forward OnPlayerLogin (playerid, pass[])public OnPlayerLogin (playerid, pass[]){ new resultline [1024]; new field [ 64]; new query [ 256]; new aName2 [MAX_PLAYER_NAME]; new aPass2 [64]; mysql_real_escape_string(PlayerName(playerid) , aName2); mysql_real_escape_string(pass , aPass2); format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `accountName`='%s' AND `Password`='%s' LIMIT 1", aName2, aPass2); mysql_query (query); mysql_store_result (); // Check if anything was found if(mysql_num_rows()) { mysql_fetch_row(resultline); mysql_fetch_field_row(field, "SQLID"); PlayerInfo[playerid][pSQLID] = strval(field); // String values - strmid // Integer values - strval // Float values - foatstr Logged[playerid] = 1; SpawnPlayerEx(playerid); } else { LoginTries[playerid]++; format(query, sizeof(query), "* [AUTH] Login failed. Bad Login Attempts: %d/3. ", LoginTries[playerid]); SendClientMessage(playerid, COLOR_LIGHTYELLOW, query); if(LoginTries[playerid] == 3) { SendClientMessage(playerid, COLOR_LIGHTYELLOW, "* [AUTH] You failed to login for 3 times in a row. You've been kicked. "); Kick(playerid); } } mysql_free_result(); return 0;}/* sscanf*/stock sscanf(string[], format[], {Float,_}:...){ #if defined isnull if (isnull(string)) #else if (string[0] == 0 || (string[0] == 1 && string[1] == 0)) #endif { return format[0]; } #pragma tabsize 4 new formatPos = 0, stringPos = 0, paramPos = 2, paramCount = numargs(), delim = ' '; while (string[stringPos] && string[stringPos] <= ' ') { stringPos++; } while (paramPos < paramCount && string[stringPos]) { switch (format[formatPos++]) { case '\0': { return 0; } case 'i', 'd': { new neg = 1, num = 0, ch = string[stringPos]; if (ch == '-') { neg = -1; ch = string[++stringPos]; } do { stringPos++; if ('0' <= ch <= '9') { num = (num * 10) + (ch - '0'); } else { return -1; } } while ((ch = string[stringPos]) > ' ' && ch != delim); setarg(paramPos, 0, num * neg); } case 'h', 'x': { new num = 0, ch = string[stringPos]; do { stringPos++; switch (ch) { case 'x', 'X': { num = 0; continue; } case '0' .. '9': { num = (num << 4) | (ch - '0'); } case 'a' .. 'f': { num = (num << 4) | (ch - ('a' - 10)); } case 'A' .. 'F': { num = (num << 4) | (ch - ('A' - 10)); } default: { return -1; } } } while ((ch = string[stringPos]) > ' ' && ch != delim); setarg(paramPos, 0, num); } case 'c': { setarg(paramPos, 0, string[stringPos++]); } case 'f': { setarg(paramPos, 0, _:floatstr(string[stringPos])); } case 'p': { delim = format[formatPos++]; continue; } case '\'': { new end = formatPos - 1, ch; while ((ch = format[++end]) && ch != '\'') {} if (!ch) { return -1; } format[end] = '\0'; if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1) { if (format[end + 1]) { return -1; } return 0; } format[end] = '\''; stringPos = ch + (end - formatPos); formatPos = end + 1; } case 'u': { new end = stringPos - 1, id = 0, bool:num = true, ch; while ((ch = string[++end]) && ch != delim) { if (num) { if ('0' <= ch <= '9') { id = (id * 10) + (ch - '0'); } else { num = false; } } } if (num && IsPlayerConnected(id)) { setarg(paramPos, 0, id); } else { #if !defined foreach #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2)) #define __SSCANF_FOREACH__ #endif string[end] = '\0'; num = false; new name[MAX_PLAYER_NAME]; id = end - stringPos; foreach (Player, playerid) { GetPlayerName(playerid, name, sizeof (name)); if (!strcmp(name, string[stringPos], true, id)) { setarg(paramPos, 0, playerid); num = true; break; } } if (!num) { setarg(paramPos, 0, INVALID_PLAYER_ID); } string[end] = ch; #if defined __SSCANF_FOREACH__ #undef foreach #undef __SSCANF_FOREACH__ #endif } stringPos = end; } case 's', 'z': { new i = 0, ch; if (format[formatPos]) { while ((ch = string[stringPos++]) && ch != delim) { setarg(paramPos, i++, ch); } if (!i) { return -1; } } else { while ((ch = string[stringPos++])) { setarg(paramPos, i++, ch); } } stringPos--; setarg(paramPos, i, '\0'); } default: { continue; } } while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ') { stringPos++; } while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' ')) { stringPos++; } paramPos++; } do { if ((delim = format[formatPos++]) > ' ') { if (delim == '\'') { while ((delim = format[formatPos++]) && delim != '\'') {} } else if (delim != 'z') { return delim; } } } while (delim > ' '); return 0;}/* ProxDetector, ProxDetectorS PlayerToPoint(Stripped) and IsPlayerInArea functions bellow.*/forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5){ if(IsPlayerConnected(playerid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); //radi = 2.0; //Trigger Radius for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(BigEar[i] < 100) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col5, string); } } else { SendClientMessage(i, col1, string); } } } }//not connected return 1;}forward ProxDetectorS(Float:dist, p1, p2);public ProxDetectorS(Float:dist, p1, p2){ if(IsPlayerConnected(p1)&&IsPlayerConnected(p2)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos (p1, oldposx, oldposy, oldposz); GetPlayerPos (p2, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); if (((tempposx < dist) && (tempposx > -dist)) && ((tempposy < dist) && (tempposy > -dist)) && ((tempposz < dist) && (tempposz > -dist))) { return 1; } } return 0;}forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z){ if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0;}forward PlayerToPointStripped(Float:radi, playerid, Float:x, Float:y, Float:z, Float:curx, Float:cury, Float:curz);public PlayerToPointStripped(Float:radi, playerid, Float:x, Float:y, Float:z, Float:curx, Float:cury, Float:curz){ if(IsPlayerConnected(playerid)) { new Float:tempposx, Float:tempposy, Float:tempposz; tempposx = (curx -x); tempposy = (cury -y); tempposz = (curz -z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) return 1; } return 0;}forward IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy);public IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy){ new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if (x > minx && x < maxx && y > miny && y < maxy) return 1; return 0;}/* Custom Functions*/forward GetHour();public GetHour(){ new tmphour, tmpminute, tmpsecond; gettime(tmphour, tmpminute, tmpsecond); return tmphour;}forward PlayerName(i);stock PlayerName(i){ new result[MAX_PLAYER_NAME] = "lol"; GetPlayerName(i, result, sizeof(result)); return result;}forward mysql_check_connection();public mysql_check_connection(){ if(mysql_ping() != -1) return printf(">> MYSQL Connection Stable. "); printf(">> MYSQL Connection was lost. Reconnecting..."); new connection = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS); if(connection) return printf(">> MYSQL Re-connection successful."); else { printf(">> Couldn't connect to MYSQL server on %s. Server terminated...", MYSQL_HOST); SendRconCommand("exit"); } return 0;}forward split(const strsrc[], strdest[][], delimiter);public split(const strsrc[], strdest[][], delimiter){ new i, li; new aNum; new len; while(i <= strlen(strsrc)){ if(strsrc[i]==delimiter || i==strlen(strsrc)){ len = strmid(strdest[aNum], strsrc, li, i, 128); strdest[aNum][len] = 0; li = i+1; aNum++; } i++; } return 1;}forward SpawnPlayerEx(i);public SpawnPlayerEx(i){ SetSpawnInfo(i, -1, SkinSlot[i][SkinWearing[i]], PlayerInfo[i][pPos_x], PlayerInfo[i][pPos_y], PlayerInfo[i][pPos_z], 0, PlayerInfo[i][pGunPrim], PlayerInfo[i][pAmmoPrim], PlayerInfo[i][pGunSec], PlayerInfo[i][pAmmoSec], -1, -1); SpawnPlayer(i);}/* Tutorials*/forward TUT01(i);forward TUT02(i);forward TUT03(i);forward TUT04(i);forward TUT05(i);forward TUT06(i);forward TUT07(i);public TUT01(i){ return 0;}public TUT02(i){ return 0;}public TUT03(i){ return 0;}public TUT04(i){ return 0;}public TUT05(i){ return 0;}public TUT06(i){ return 0;}public TUT07(i){ return 0;}