10.11.2009, 20:48
well i am making a death match server as now i have gotten to know pawno well in my stunt server, so i was working on my registration command and i was trying to think how i could make weapon saving work so instead of messing with a the game FS to test my code and it works, but doesnt.
so this works and doesn't ill get my weapons and i would have brass knuckles, ak47, and a uzi, so i type the command /text and it removes them then i wait the 5 seconds, and i only get my brass knuckles back. ??
can someone help me please all help is very great full
Код:
//---(>Includes<)--- #include <a_samp> //---(>Dcmd<)--- #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 //---(>Colors<)--- #define COLOR_GREEN 0x00FF00AA #define COLOR_YELLOW 0xFFFF00FF #define COLOR_WHITE 0xFFFFFFAA #define COLOR_SKYBLUE 0x99FFFFAA #define COLOR_RED 0xAA3333AA #define COLOR_ORANGE 0xFF9900AA #define COLOR_PURPLE 0xB360FDFF #define COLOR_BLUE 0x1229FAFF #define COLOR_PINK 0xE100E1FF #define COLOR_SYSTEM 0xEFEFF7AA #define COLOR_GRAY 0xCECECEFF enum wData { Slot1, Slot2, Slot3, Slot4, Slot5, Slot6, Slot7, Slot8, Slot9, Slot10, Slot11, Slot12 }; enum sAmmo { aSlot1, aSlot2, aSlot3, aSlot4, aSlot5, aSlot6, aSlot7, aSlot8, aSlot9, aSlot10, aSlot11, aSlot12 }; new pWeaponData[MAX_PLAYERS][wData]; new pAmmoData[MAX_PLAYERS][sAmmo]; public OnFilterScriptInit() { return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerSpawn(playerid) { GivePlayerWeapon(playerid, 24, 1337); GivePlayerWeapon(playerid, 29, 666); GivePlayerWeapon(playerid, 31, 101); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/test", true)==0) { new weaponid; pWeaponData[playerid][Slot1] = GetPlayerWeaponData(playerid, 1, weaponid, pAmmoData[playerid][aSlot1]); pWeaponData[playerid][Slot2] = GetPlayerWeaponData(playerid, 2, weaponid, pAmmoData[playerid][aSlot2]); pWeaponData[playerid][Slot3] = GetPlayerWeaponData(playerid, 3, weaponid, pAmmoData[playerid][aSlot3]); pWeaponData[playerid][Slot4] = GetPlayerWeaponData(playerid, 4, weaponid, pAmmoData[playerid][aSlot4]); pWeaponData[playerid][Slot5] = GetPlayerWeaponData(playerid, 5, weaponid, pAmmoData[playerid][aSlot5]); pWeaponData[playerid][Slot6] = GetPlayerWeaponData(playerid, 6, weaponid, pAmmoData[playerid][aSlot6]); pWeaponData[playerid][Slot7] = GetPlayerWeaponData(playerid, 7, weaponid, pAmmoData[playerid][aSlot7]); pWeaponData[playerid][Slot8] = GetPlayerWeaponData(playerid, 8, weaponid, pAmmoData[playerid][aSlot8]); pWeaponData[playerid][Slot9] = GetPlayerWeaponData(playerid, 9, weaponid, pAmmoData[playerid][aSlot9]); pWeaponData[playerid][Slot10] = GetPlayerWeaponData(playerid, 10, weaponid, pAmmoData[playerid][aSlot10]); pWeaponData[playerid][Slot11] = GetPlayerWeaponData(playerid, 11, weaponid, pAmmoData[playerid][aSlot11]); pWeaponData[playerid][Slot12] = GetPlayerWeaponData(playerid, 12, weaponid, pAmmoData[playerid][aSlot11]); ResetPlayerWeapons(playerid); SetTimerEx("RestoreWeapons", 5000, 0, "i", playerid); SendClientMessage(playerid, COLOR_GREEN, "- Your weapons will be restored in 5 seconds!"); return 1; } return 0; } forward RestoreWeapons(playerid); public RestoreWeapons(playerid) { GivePlayerWeapon(playerid, pWeaponData[playerid][Slot1], pAmmoData[playerid][aSlot1]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot2], pAmmoData[playerid][aSlot2]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot3], pAmmoData[playerid][aSlot3]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot4], pAmmoData[playerid][aSlot4]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot5], pAmmoData[playerid][aSlot5]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot6], pAmmoData[playerid][aSlot6]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot7], pAmmoData[playerid][aSlot7]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot8], pAmmoData[playerid][aSlot8]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot9], pAmmoData[playerid][aSlot9]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot10], pAmmoData[playerid][aSlot10]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot11], pAmmoData[playerid][aSlot11]); GivePlayerWeapon(playerid, pWeaponData[playerid][Slot12], pAmmoData[playerid][aSlot12]); SendClientMessage(playerid, COLOR_GREEN, "- Your weapons have been restored!"); } //---(>Sscanf - End of Script<)--- stock sscanf(string[], format[], {Float,_}:...) { new formatPos = 0, stringPos = 0, paramPos = 2, paramCount = numargs(); 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 (ch >= '0' && ch <= '9') { num = (num * 10) + (ch - '0'); } else { return 1; } } while ((ch = string[stringPos]) && ch != ' '); setarg(paramPos, 0, num * neg); } case 'h', 'x': { new ch, num = 0; while ((ch = string[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)); } case ' ': { break; } default: { return 1; } } } setarg(paramPos, 0, num); } case 'c': { setarg(paramPos, 0, string[stringPos++]); } case 'f': { new tmp[25]; strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2); setarg(paramPos, 0, _:floatstr(tmp)); } case 's', 'z': { new i = 0, ch; if (format[formatPos]) { while ((ch = string[stringPos++]) && ch != ' ') { 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] != ' ') { stringPos++; } while (string[stringPos] == ' ') { stringPos++; } paramPos++; } while (format[formatPos] == 'z') formatPos++; return format[formatPos]; }
can someone help me please all help is very great full