Anti-WeaponHack 2Bugs - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti-WeaponHack 2Bugs (
/showthread.php?tid=421015)
Anti-WeaponHack 2Bugs -
Akcent_Voltaj - 07.03.2013
i have it at onplayerupdate
1.Kicks when some people at connect..inocent people
2.Spams the chat
please help!
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
new sendername[MAX_PLAYER_NAME];
GetPlayerName(i, sendername, sizeof(sendername));
new string[256];
if(GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 37 || GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 17)
{
format(string, sizeof(string), "%s a primit Kick de la BOT, Motiv: Weapon Hack",sendername);
SendClientMessageToAll(COLOR_RED, string);
Kick(i);
return 1;
}
}
Re: Anti-WeaponHack 2Bugs -
Hoborific - 07.03.2013
Add a boolean with MAX_PLAYERS to OnPlayerSpawn, set it to 1, Set it to 0 when they disconnect or die, check the variable in your loop.
Re: Anti-WeaponHack 2Bugs -
Jefff - 08.03.2013
Try
top
pawn Код:
new bool:IsPlayerSpawned[MAX_PLAYERS];
connect/death
pawn Код:
IsPlayerSpawned[playerid] = false;
OnPlayerSpawn
pawn Код:
SetTimerEx("Spawned",1000,false,"d",playerid);
somewhere
pawn Код:
forward Spawned(playerid);
public Spawned(playerid)
{
IsPlayerSpawned[playerid] = true;
return 1;
}
pawn Код:
static Weapon;
new string[128],sendername[MAX_PLAYER_NAME + 1];
for(new i; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && IsPlayerSpawned[i])
{
Weapon = GetPlayerWeapon(i);
if(Weapon == 35 || Weapon == 37 || Weapon == 38 || Weapon == 17)
{
IsPlayerSpawned[i] = false;
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "%s a primit Kick de la BOT, Motiv: Weapon Hack",sendername);
SendClientMessageToAll(COLOR_RED, string);
Kick(i);
}
}