01.01.2016, 11:56
Hi this is my anti weapon hack
Please help me for +Rep
PHP код:
new bool:ACWep[MAX_PLAYERS][50];
new TofAll[MAX_PLAYERS];
new Cheating[MAX_PLAYERS];
stock GivePlayerGun(plyid, weaponid, ammo)
{
if(unsentwep[plyid] == 1)
{
GivePlayerGun(plyid, weaponid, ammo);
return 1;
}
ACWep[plyid][weaponid] = true;
GivePlayerWeapon(plyid, weaponid, ammo);
return 1;
}
public OnPlayerDeath(playerid,killerid,reason);
{
TofAll[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
TofAll[playerid] = 1;
return 1;
}
public OnPlayerConnect(playerid)
{
for(new i;i<46;i++) ACWep[playerid][i] = true;
TofAll[playerid] = 0;
Cheating[playerid] = 0;
CheckWeaponTime[playerid] = SetTimerEx("CheckWeaponHack",1000,true,"i",playerid);
return 1;
}
PHP код:
public CheckWeaponHack(playerid)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 1 && TofAll[playerid] == 1 && Cheating[playerid] == 0)
{
for(new i = 1;i<46;i++)
{
if(i > 20 || i < 18)
{
if(GetPlayerWeapon(playerid) == i && ACWep[playerid][i] != true)
{
new reason[70], WeapName[50];
GetWeaponName(i, WeapName, 50);
format(reason, 70, "Weapon hack(%s)", WeapName);
BanPlayer(INVALID_PLAYER_ID, PINFO[playerid][pName], 0, reason);
Cheating[playerid] = 1;
}
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && PINFO[playerid][pAdmin] <= 0)
{
new cheatername[MAX_PLAYER_NAME];
GetPlayerName(playerid,cheatername,MAX_PLAYER_NAME);
BanPlayer(INVALID_PLAYER_ID, cheatername, 0, "Weapon hack(Jetpack)");
Cheating[playerid] = 1;
return 1;
}
}
}
return 1;
}