SA-MP Forums Archive
GiveWeapon command isn't working - 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: GiveWeapon command isn't working (/showthread.php?tid=268250)



GiveWeapon command isn't working - cloudysky - 11.07.2011

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;
}



Re: GiveWeapon command isn't working - [MG]Dimi - 11.07.2011

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



Re: GiveWeapon command isn't working - WazzaJB - 11.07.2011

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.


Re: GiveWeapon command isn't working - cloudysky - 11.07.2011

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 :/