Command not 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)
+--- Thread: Command not working (
/showthread.php?tid=631308)
Command not working -
jasperschellekens - 26.03.2017
Hello.
I have a problem with a command.
The command does not create a item or display the test message.
What am i doing wrong?
PHP код:
CMD:createitem(playerid,params[])
{
new modelid;
if(sscanf(params,"u",modelid)) return SendClientMessage(playerid,GREY,"USAGE: /createitem [itemid]");
if(modelid == 3026)
{
AddItem(playerid,modelid);
}
if(modelid == 346)
{
AddItem(playerid,modelid);
}
if(modelid == 336)
{
AddItem(playerid,modelid);
}
if(modelid == 849)
{
AddItem(playerid,modelid);
Inventory[playerid][InvSlots] += 1;
Inventory[playerid][InvInduScraps] += 1;
SendClientMessage(playerid,GREY,"test message");
}
return 1:
}
Re: Command not working -
ISmokezU - 26.03.2017
Try:
PHP код:
CMD:createitem(playerid,params[])
{
new modelid;
if(sscanf(params,"u", modelid)) return SendClientMessage(playerid, GREY ,"USAGE: /createitem [itemid]");
if(modelid == 3026) AddItem(playerid, modelid);
else if(modelid == 346) AddItem(playerid, modelid);
else if(modelid == 336) AddItem(playerid, modelid);
else if(modelid == 849)
{
AddItem(playerid ,modelid);
Inventory[playerid][InvSlots] += 1;
Inventory[playerid][InvInduScraps] += 1;
SendClientMessage(playerid, GREY , "test message");
}
return 1:
}
Re: Command not working -
jasperschellekens - 26.03.2017
Does not work unfortunately
Re: Command not working -
Variable™ - 26.03.2017
Try changing the "u" specifier in sscanf to "i".
Re: Command not working -
jasperschellekens - 26.03.2017
Quote:
Originally Posted by Variable™
Try changing the "u" specifier in sscanf to "i".
|
Thank you, it worked.