Help With /giveallweapon command
#1

hello.. can you fix my code ? rep

pawn Код:
CMD:giveallweapon(playerid, params[])
{
        if(PlayerInfo[playerid][pAdmin] < 2 && !IsPlayerAdmin(playerid)) return SendClientMessage( playerid, -1, "You Must Be Level 3 Use This Command");
       
        new weaponid,ammo;
        new name[MAX_PLAYER_NAME];
        if(sscanf(params, "dd", weaponid,ammo)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /giveallweapon [weaponid] [ammo]");
        {
        if(!IsValidWeapon(weaponid)) return SendClientMessage(playerid,-1,"ERROR: Invalid Weapon ID");
       
        if(weaponid == 45 ) return SendClientMessage(playerid,-1,"ERROR: You Cannot Give All Player This Weapons!");
       
        GetPlayerName(playerid, name, sizeof(name));
        new welcome[500];
        format(welcome, sizeof(welcome), "{00FF22}Administrator %s Has Given All Player Weapon %d | %d ", name,weaponid,ammo);
        SendClientMessageToAll(-1,welcome);
       
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
           if(IsPlayerConnected(i))
           {
             PlayerPlaySound(i,1057,0.0,0.0,0.0);
             GivePlayerWeapon(i,weaponid,ammo);
           }
        }
        }
        return 1;
}

is this correct ?
pawn Код:
if(weaponid == 45 ) return SendClientMessage(playerid,-1,"ERROR: You Cannot Give All Player This Weapons!");

but why i /giveallweapon 45 9999 its working ?
Reply
#2

Change it to if(weaponid >= 45) return [code....]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)