Ban problem..
#1

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..?
Reply
#2

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.
Reply
#3

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)