SA-MP Forums Archive
Ban problem.. - 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: Ban problem.. (/showthread.php?tid=304048)



Ban problem.. - Unknownich - 16.12.2011

Hi all, I have "fast" question, I scripted this simple weapon anitcheat,
Quote:

public anticheat()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37)
{
new pname[MAX_PLAYER_NAME];
new string[124];
GetPlayerName(i, pname, sizeof(pname));
format(string, sizeof(string), " %s has been banned! Reason: Forbidden weapon", pname);
SendClientMessageToAll(COLOR,string);
BanEx(i,string);
}
}
return 1;
}

It works, but, the next player who joins the server with ID of banned player get banned to, Im not sure why..
There is few ways to solve this, for example this simple code << if(Spawned[i] == 0) return 1;>> this check if player is spawned, if not it wont be banned. Im not sure what is wrong with this..?


Re: Ban problem.. - GamingTurf - 16.12.2011

Make a new global int:

At top of script
PlayerLogged[MAX_PLAYERS];

under OnPlayerConnect:
PlayerLogged[playerid] = 0;

under your Login Feature:
PlayerLogged[playerid] = 1;

Now edit your anticheat:
if(GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37 && PlayerLogged[i] == 1)

Should work.


Re: Ban problem.. - Unknownich - 16.12.2011

Quote:
Originally Posted by GamingTurf
Посмотреть сообщение
Make a new global int:

At top of script
PlayerLogged[MAX_PLAYERS];

under OnPlayerConnect:
PlayerLogged[playerid] = 0;

under your Login Feature:
PlayerLogged[playerid] = 1;

Now edit your anticheat:
if(GetPlayerWeapon(i) == 36 || GetPlayerWeapon(i) == 37 && PlayerLogged[i] == 1)

Should work.
Yea, this will probably work (Im not using this code btw). There is few other ways to stop this, but I wanna know why player get banned without this..