SA-MP Forums Archive
Code Issue? - 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: Code Issue? (/showthread.php?tid=263359)



Code Issue? - Lynn - 21.06.2011

Well when I set my Admin level to 0, or create a new account, log in, give my self a badweapon, it does nothing.
pawn Код:
//GameModeInit
SetTimer("WeaponHack", 1000, true);
//--------------------------
public WeaponHack(playerid, weaponid)
{
    WeaponHackCheck(playerid, weaponid);
    return 1;
}
stock WeaponHackCheck(playerid, weaponid)
{
    new WeaponName[128];
    new string[128];
    GetWeaponName( weaponid, WeaponName, sizeof( WeaponName ) );
    if(!IsAdmin(playerid,1))
    {
        switch (weaponid)
        {
            case 1,18:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%s)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
            case 23:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%s)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
            case 25,26:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%s)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
            case 28,29:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%s)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
            case 32,34:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%s)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
            case 36,46:
                {
                    format(string,sizeof(string),"%s has been banned for weapon Hacking(%i)",pName(playerid), WeaponName);
                    SendClientMessageToAll(COLOR_LIGHTRED,string);
                    PlayerInfo[playerid][pBanned] = 1;
                    Kick(playerid);
                }
        }
    }
    return 1;
}



Re: Code Issue? - linuxthefish - 21.06.2011

You need to loop through all the players, and get there weapon ID's. Or have a look at SetTimerEx.


Re: Code Issue? - Lynn - 21.06.2011

Oh my, how did I forget that xD
You're a life saver.