SA-MP Forums Archive
[Solved]A little help. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved]A little help. (/showthread.php?tid=73454)



[Solved]A little help. - ReV. - 15.04.2009

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


Re: A little help. - Danut - 15.04.2009

pastebin please


Re: A little help. - Clum` - 15.04.2009

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



Re: A little help. - Weirdosport - 15.04.2009

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


Re: A little help. - ReV. - 15.04.2009

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


Re: A little help. - ReV. - 15.04.2009

EDIT: Solved