Ich habe ein Antiwaffenhack System angefangen nun komm ich nicht weiter wie ich es checken soll ?
enum SpielerDaten
{
bool:WeaponGived,
Weapons[13],
Ammos[13]
stock GetWeaponSlot(weaponid){
new slot;
if(weaponid == 0 || weaponid == 1) { slot = 0; }
else if(weaponid >= 2 && weaponid <= 9) { slot = 1; }
else if(weaponid >= 22 && weaponid <= 24) { slot = 2; }
else if(weaponid >= 25 && weaponid <= 27) { slot = 3; }
else if(weaponid == 28 || weaponid == 29 || weaponid == 32) { slot = 4; }
else if(weaponid == 30 || weaponid == 31) { slot = 5; }
else if(weaponid == 33 || weaponid == 34) { slot = 6; }
else if(weaponid >= 35 && weaponid <= 38) { slot = 7; }
else if((weaponid >= 16 && weaponid <= 18) || weaponid == 39) { slot = 8; }
else if(weaponid >= 41 && weaponid <= 43) { slot = 9; }
else if(weaponid >= 10 && weaponid <= 15) { slot = 10; }
else if(weaponid >= 44 && weaponid <= 46) { slot = 11; }
else if(weaponid) { slot = 12; }
else { slot = 0; }
return slot;
}
Mysql Speichern und Loaden
for(new slot=0;slot<13;slot++)
{
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot1", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot2", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot3", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot4", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot5", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot6", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot7", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot8", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot9", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot10", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot11", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Weapons][slot] = mysql_GetInt("accounts", "Waffenslot12", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo1", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo2", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo3", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo4", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo5", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo6", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo7", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo8", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo9", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo10", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo11", "Name", PlayerInfo[playerid][pName]);
PlayerInfo[playerid][Ammos][slot] = mysql_GetInt("accounts", "Waffenammo12", "Name", PlayerInfo[playerid][pName]);
}
for(new slot=0;slot<13;slot++)
{
mysql_SetInt("accounts", "Waffenslot1", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot2", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot3", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot4", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot5", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot6", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot7", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot8", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot9", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot10", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot11", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenslot12", PlayerInfo[playerid][Weapons][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo1", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo2", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo3", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo4", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo5", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo6", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo7", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo8", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo9", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo10", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo11", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
mysql_SetInt("accounts", "Waffenammo12", PlayerInfo[playerid][Ammos][slot], "Name", PlayerInfo[playerid][pName]);
}
Function AntiGivePlayerWeapon(playerid, weaponid, ammo)
{
if(IsPlayerConnected(playerid) && (weaponid && ammo))
{
PlayerInfo[playerid][WeaponGived] = true;
PlayerInfo[playerid][Weapons][GetWeaponSlot(weaponid)] = weaponid;
PlayerInfo[playerid][Ammos][GetWeaponSlot(weaponid)] += ammo;
GivePlayerWeapon(playerid, weaponid, ammo);
PlayerInfo[playerid][WeaponGived] = false;
}
return 1;
}
Function AntiResetPlayerWeapons(playerid)
{
if(IsPlayerConnected(playerid))
{
ResetPlayerWeapons(playerid);
PlayerInfo[playerid][WeaponGived] = true;
for(new slot=0;slot<13;slot++)
{
PlayerInfo[playerid][Weapons][slot] = 0;
PlayerInfo[playerid][Ammos][slot] = 0;
}
PlayerInfo[playerid][WeaponGived] = false;
}
return 1;
}
Und wie soll ich es Checken ?
MFG
SuTroX