21.10.2011, 23:44
Hoje fiz um anti-cheat, porйm ele estб banindo quem nao deveria, alguйm poderia me ajudar a resolver meu erro?
pawn Код:
#include <a_samp>
#define SLOTS_WEAPON 13
enum pInfo
{
pWeapon[SLOTS_WEAPON],
pAmmo[SLOTS_WEAPON]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new WeaponsSlot[47] = {
00, // 00
00, // 01
01, // 02
01, // 03
01, // 04
01, // 05
01, // 06
01, // 07
01, // 08
01, // 09
10, // 10
10, // 11
10, // 12
10, // 13
10, // 14
10, // 15
08, // 16
08, // 17
08, // 18
00, // 19
00, // 20
00, // 21
02, // 22
02, // 23
02, // 24
03, // 25
03, // 26
03, // 27
04, // 28
04, // 29
05, // 30
05, // 31
04, // 32
06, // 33
06, // 34
07, // 35
07, // 36
07, // 37
07, // 38
08, // 39
12, // 40
09, // 41
09, // 42
09, // 43
11, // 44
11, // 45
11 // 46
};
public OnPlayerConnect(playerid)
{
ResetPlayerWeaponsEx(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
ResetPlayerWeaponsEx(playerid);
return 1;
}
stock ResetPlayerWeaponsEx(playerid)
{
ResetPlayerWeapons(playerid);
for(new slot = 0; slot < SLOTS_WEAPON; slot++)
{
PlayerInfo[playerid][pWeapon][slot] = 0;
PlayerInfo[playerid][pAmmo][slot] = 0;
}
return 1;
}
stock GivePlayerWeaponEx(playerid, weaponid, ammo)
{
if(IsPlayerConnected(playerid))
{
////////////////////////////////////////////////////////////////////////
new slot = WeaponsSlot[weaponid];
PlayerInfo[playerid][pWeapon][slot] = weaponid;
PlayerInfo[playerid][pAmmo][slot] = ammo;
////////////////////////////////////////////////////////////////////////
GivePlayerWeapon(playerid, weaponid, ammo);
}
return 1;
}
stock CheckWeaponsCheat(playerid)
{
for(new slot = 0; slot < SLOTS_WEAPON; slot++)
{
new weapon, ammo;
GetPlayerWeaponData(playerid, slot, weapon, ammo);
if(ammo > 0) {
if(weapon != PlayerInfo[playerid][pWeapon][slot]) return 1;
}
}
return 0;
}
stock RemovePlayerWeapon(playerid, weaponid)
{
new Weapon[SLOTS_WEAPON], Ammo[SLOTS_WEAPON];
for(new slot = 0; slot < SLOTS_WEAPON; slot++)
{
new weapon, ammo;
GetPlayerWeaponData(playerid, slot, weapon, ammo);
if(weapon != weaponid) {
Weapon[slot] = weapon; Ammo[slot] = ammo;
}
}
ResetPlayerWeaponsEx(playerid);
for(new slot = 0; slot < SLOTS_WEAPON; slot++)
{
GivePlayerWeaponEx(playerid, Weapon[slot], Ammo[slot]);
}
return 1;
}