[Solved]A little help.
#1

pawn Код:
public AntiCheat(playerid)
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {  
                new gun,ammo;
                for(new w; w < 13; w++)
                {
                    GetPlayerWeaponData(i,w,gun,ammo);
                    if(gun)
                    {
                        for(new g; g < sizeof(HackWeapons); g++)
                        {
                            if(gun == HackWeapons[g])
                            {
                                JailPlayer(i);
                                new string[64];
                                format(string, sizeof(string), "[ANTI-CHEAT] %s has been kicked for weapon hacking!", pName(playerid));
                                KickLog(string);
                                SendClientMessageToAll(ADMIN_RED, string);
                                Kick(i);
                            }
                        }
                    }
                }
          }
     }    
}
I'm having a small problem with this, works fine, but when the player get's kicked it spams "[ANTI-CHEAT] %s has been kicked for weapon hacking!".
Here's what I mean,
Quote:

[ANTI-CHEAT] [name] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!
[ANTI-CHEAT] has been kicked for weapon hacking!

I have other things running on the same timer, they work completely fine. Anyone know what's wrong?..

EDIT: Solved, forgot to stop the loop
Reply
#2

pastebin please
Reply
#3

[quote=Fatal ]
pawn Код:
public AntiCheat(playerid)
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {  
                new gun,ammo;
                for(new w; w < 13; w++)
                {
                    GetPlayerWeaponData(i,w,gun,ammo);
                    if(gun) // Huh?
                    {
                        for(new g; g < sizeof(HackWeapons); g++)
                        {
                            if(gun == HackWeapons[g])
                            {
                                JailPlayer(i);
                                new string[64];
                                format(string, sizeof(string), "[ANTI-CHEAT] %s has been kicked for weapon hacking!", pName(playerid));
                                KickLog(string);
                                SendClientMessageToAll(ADMIN_RED, string);
                                Kick(i);
                            }
                        }
                    }
                }
          }
     }    
}
Reply
#4

if(gun) is the just checks whether gun is not 0... if gun is 4 it will return true and continue. If there's no gun there it will return false and stop.. I think
Reply
#5

Quote:
Originally Posted by MoroJr™
pastebin please
You can't read the pawn tags above? And from what you know, I doubt you can help at all.


Quote:
Originally Posted by Clum`
Quote:
Originally Posted by Fatal
pawn Код:
public AntiCheat(playerid)
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {  
                new gun,ammo;
                for(new w; w < 13; w++)
                {
                    GetPlayerWeaponData(i,w,gun,ammo);
                    if(gun) // Huh?
                    {
                        for(new g; g < sizeof(HackWeapons); g++)
                        {
                            if(gun == HackWeapons[g])
                            {
                                JailPlayer(i);
                                new string[64];
                                format(string, sizeof(string), "[ANTI-CHEAT] %s has been kicked for weapon hacking!", pName(playerid));
                                KickLog(string);
                                SendClientMessageToAll(ADMIN_RED, string);
                                Kick(i);
                            }
                        }
                    }
                }
           }
      }    
}
The original code was by 90nine, I modified it a bit. You can ignore that, I'll remove it after getting this bugged fixed..
Reply
#6

EDIT: Solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)