what's wrong with this command? - 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: what's wrong with this command? (
/showthread.php?tid=175096)
what's wrong with this command? -
Face9000 - 08.09.2010
I all,i use EasyAdministration FS,i've a problem with the /giveweapon command.
When i use /giveweapon playerid weaponid ammo,he say this:
Код:
You have given the player WEAPONID PLAYERID AMMO
I've tried the command on myself and dont work..no weapon given..
Here is the command.
Код:
dcmd_giveweapon(playerid,params[])
{
if(Player[playerid][admin] < 2){
return SendClientMessage (playerid,COLOR_RED,"You must be a Admin or higher to give weapons");
}
new pID,weapon,ammo;
if(sscanf(params,"udd",pID,weapon,ammo)){
return SendClientMessage(playerid,COLOR_RED,"USAGE: /giveweapon [playerid][weaponID] [ammo]");
}
if(!IsPlayerConnected(pID)){
return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
}
new string[128],string2[128],aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,aname,sizeof(aname));
GetPlayerName(pID,name,sizeof(name));
GivePlayerWeapon(pID,weapon,ammo);
format(string,sizeof(string),"You have given the player %s weapon ID:%d with %d ammo",name,weapon,ammo);
format(string2,sizeof(string2),"Admin %s has give you weapon ID:%d with %d ammo",aname,weapon,ammo);
SendClientMessage(playerid,COLOR_GREEN,string);
SendClientMessage(pID,COLOR_GREEN,string2);
return 1;
}
Thanks
Re: what's wrong with this command? -
Face9000 - 08.09.2010
No one can help me?
Re: what's wrong with this command? -
Mike_Peterson - 08.09.2010
no errors?
not sure about weapon and ammo btw try new weaponid; not that it makes difference i think....
im not experienced in dcmd....
but doesnt it need strval?
i see that at my gamemode that u need strval
Re: what's wrong with this command? -
notime - 08.09.2010
Quote:
Originally Posted by Mike_Peterson
but doesnt it need strval?
i see that at my gamemode that u need strval
|
nah, sscanf doesnt need strval
Код:
if(sscanf(params,"udd",pID,weapon,ammo))
im not really sure, but maybe the "udd" should be "idd" but then u cant insert a part of the name anymore
or u could keep "udd" and define pID as a string, so