Help me create a simple 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)
+--- Thread: Help me create a simple command (
/showthread.php?tid=524112)
Help me create a simple command -
friezakinght - 05.07.2014
Hi, I would like to ask you guys to help me into creating a simple command using ZCMD and sscanf, I want it to be like: /usedrugs [drugname] and then there's like 3 drug types, let's say weed, cocaine and heroine so If the player typed /usedrugs weed then the command will be assigned a different code, but if he typed /usedrugs cocaine another code and so on, please help me I'm new.
I will +Rep.
Re: Help me create a simple command -
Stanford - 05.07.2014
I hope I helped!>
pawn Код:
CMD:usedrugs(playerid, params[])
{
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You're not even connected to the server.");
new drugsname[32];
if(sscanf(params,"s[32]",drugsname))
{
SendClientMessage(playerid, -1, "USAGE: /usedrugs [drugname]");
SendClientMessage(playerid, -1, "CHOICES: Cocaine, Heroine, Weed."); // Add more if you want.
return 1;
}
if(strcmp(drugsname, "cocaine", true) == 0)
{
// your code
}
if(strcmp(drugsname, "weed", true) == 0)
{
// your code
}
if(strcmp(drugsname, "heroine", true) == 0)
{
// your code
}
return 1;
}
Any feedback would be appreciated
Re: Help me create a simple command -
friezakinght - 05.07.2014
Thank you so much. You really helped me.
+repped