#1

Hello.
How can I do if when using / givegun and not put a parameter (eg / givegun ID) can not be used.
If yes / givegun defends his entire command id (id weapon bullets), I hope you understand.
I mean if you do not write complete command (/ givegun id weapon bullets) to the message does not appear again to be able to use the command
Excuse my English.

pawn Код:
if(strcmp(cmd, "/givegun", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 2)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_SERVER, "Foloseste: {FFFFFF}/givegun [playerid] [weapon] [gloante]");
                    return 1;
                }
                new GunID;
                new Ammo;
                PlayerID = ReturnUser(tmp);
                tmp = strtok(cmdtext, idx);
                GunID = strval(tmp);
                tmp = strtok(cmdtext, idx);
                Ammo = strval(tmp);
                if(IsPlayerConnected(PlayerID))
                {
                    if(PlayerID != INVALID_PLAYER_ID)
                    {
                        GivePlayerWeapon(PlayerID, GunID, Ammo);
                    }
                }
            }
        }
        return 1;
    }
Reply
#2

I have no idea what you actually mean, but a look at your code was enought to see that you need to update to 'sscanf'.

https://sampwiki.blast.hk/wiki/Sscanf
Reply
#3

pawn Код:
if(strcmp(cmd, "/givegun", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 2)
            {
                new id ,weap ,ammo;
                if(sscanf(params, "uii",id,weap,ammo)) return SendClientMessage(playerid, -1, "/givegun [playerid] [weapon] [gloante]") ;
               
                if(IsPlayerConnected(PlayerID))
                {
                    if(PlayerID != INVALID_PLAYER_ID)
                    {
                        GivePlayerWeapon(id, weapid, ammo);
                    }
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)