Code Issue?
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)