GiveWeapon command isn't working
#1

Hi i'm still getting to grips with Sscanf and i think i've put the wrong letter because this isn't working. In the black box it says (server.exe) "Format specifier does not meet parameter count."

pawn Код:
command(agiveweapon, playerid, params[])
{
    if( PlayerInfo[playerid][Admin] >= 2)
    {
        new pid;
        new wep;
        new ammo;
       
        if(sscanf(params, "ud", pid, wep, ammo)) return SendClientMessage(playerid, COLOUR_WHITE, "Hint: /giveweapon [Playerid] [Weaponid] [Ammo]");
        if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOUR_WHITE, "That player is not connected.");
        if(wep < 0 || wep > 46 )  return SendClientMessage(playerid, COLOUR_WHITE, "Weapon ID has to be between 0 and 46!");
        GivePlayerWeapon(pid,wep,ammo);
    }
    return 1;
}
Reply
#2

I think it should be
PHP код:
command:agiveweapon(playeridparams[]) 
Reply
#3

pawn Код:
if(sscanf(params, "udd", pid, wep, ammo)) return SendClientMessage(playerid, COLOUR_WHITE, "Hint: /giveweapon [Playerid] [Weaponid] [Ammo]");
You missed a "d" mate.

EDIT:

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
I think it should be
PHP код:
command:agiveweapon(playeridparams[]) 
Read the error before supplying a response, the error is obviously sent via sscanf.
Reply
#4

Not it's not the start of the command that's the problem I don't think


Quote:
Originally Posted by WazzaJB
Посмотреть сообщение
pawn Код:
if(sscanf(params, "udd", pid, wep, ammo)) return SendClientMessage(playerid, COLOUR_WHITE, "Hint: /giveweapon [Playerid] [Weaponid] [Ammo]");
You missed a "d" mate.
Thanks :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)