Anti-WeaponHack 2Bugs
#1

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;
                            }
                        }
Reply
#2

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

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);
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)