/command [something] - 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 [something] (
/showthread.php?tid=474439)
/command [something] -
Stinged - 08.11.2013
Hello everyone! I'm new to this scripting stuff. I read tutorials and watched some ******* videos, and I learned some shit.
I am having a problem I need help with.
If you want to mock me or whatever, please don't post here.
If you wanted to help, please don't post the code without explaining anything, I don't like copy paste, I like to learn it before using it.
I am trying to make something like /command [option] [Example: /hat [color]]
I know how to add the hats and shit, but how can I make a command with options?
Thanks.
Re: /command [something] - Astralis - 08.11.2013
Quote:
Originally Posted by Stinged
Hello everyone! I'm new to this scripting stuff. I read tutorials and watched some ******* videos, and I learned some shit.
I am having a problem I need help with.
If you want to mock me or whatever, please don't post here.
If you wanted to help, please don't post the code without explaining anything, I don't like copy paste, I like to learn it before using it.
I am trying to make something like /command [option] [Example: /hat [color]]
I know how to add the hats and shit, but how can I make a command with options?
Thanks.
|
you can use dialogs.
Re: /command [something] -
Stinged - 08.11.2013
I can. But... Uh, I'm just learning how to use the /command [option] thing, so I asked for help.
Re: /command [something] -
NeMoK - 08.11.2013
pawn Код:
#include <sscanf2>
#include <zcmd>
#define SCM SendClientMessage
#define COLOR_ERROR 0x808080FF
CMD:hat(playerid,params[])
{
new color[28];
if(sscanf(params,"s[28]",color)) return SCM(playerid,COLOR_ERROR,"Usage: /hat [color]");
if(strcmp(color, "blue", true)==0)
{
//HERE What happens if they write blue or BlUe or BLUE or bLuE etc..
}
if(strcmp(color, "red", true)==0)
{
//HERE What happens if they write red etc..
}
return 1;
}
HERE the sscanf2
https://sampforum.blast.hk/showthread.php?tid=120356
HERE the zcmd
https://sampforum.blast.hk/showthread.php?tid=91354
Re: /command [something] -
Stinged - 08.11.2013
Quote:
Originally Posted by NeMoK
pawn Код:
#include <sscanf2> #include <zcmd>
#define SCM SendClientMessage #define COLOR_ERROR 0x808080FF
CMD:hat(playerid,params[]) { new color[28]; if(sscanf(params,"s[28]",color)) return SCM(playerid,COLOR_ERROR,"Usage: /hat [color]"); if(strcmp(color, "blue", true)==0) { //HERE What happens if they write blue or BlUe or BLUE or bLuE etc.. } if(strcmp(color, "red", true)==0) { //HERE What happens if they write red etc.. }
return 1; }
|
I will try it right now. Thank you for helping me.
Re: /command [something] -
NeMoK - 08.11.2013
let me know if there is any problem.
Re: /command [something] -
Stinged - 08.11.2013
Thank you, NeMoK.
It worked perfectly.
+1 reputation.
Re: /command [something] -
NeMoK - 08.11.2013
Perfect. Thanks to you.