how to do this with sscanf: /cmd join. /cmd leave - 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: how to do this with sscanf: /cmd join. /cmd leave (
/showthread.php?tid=526240)
how to do this with sscanf: /cmd join. /cmd leave -
[Cali]ChrOnic_T - 16.07.2014
What paremeters do i use for this can someone explain to me how or give a example command?
Example: /gang join , /gang leave . /gang leader,etc . please reply.
Re: how to do this with sscanf: /cmd join. /cmd leave -
Jack_Leslie - 16.07.2014
Not tested, but as an example for you:
pawn Код:
CMD:gang(playerid, params[])
{
new gangid;
if(isnull(params)) return SendClientMessage(playerid, COLOR_SYNTAX, "Syntax: /gang [join/leave]");
if(strcmp(params, "join", true) == 0)
{
if(sscanf(params, "i", gangid)) return SendClientMessage(playerid, COLOR_SYNTAX, "Syntax: /gang join [gang id]");
//join...
return 1;
}
else if(strcmp(params, "leave", true) == 0)
{
//leave..
}
else
{
SendClientMessage(playerid, COLOR_SYNTAX, "Syntax: /gang [join/leave]");
}
return 1;
}
Re: how to do this with sscanf: /cmd join. /cmd leave -
Naresh - 16.07.2014
Jack u r so helping

+Rep
Re: how to do this with sscanf: /cmd join. /cmd leave -
Stanford - 16.07.2014
pawn Код:
CMD:gang(playerid, params[])
{
new choice[32];
if(sscanf(params,"s[32]",choice))
{
SendClientMessage(playerid, -1, "USAGE: /gang [choice]");
SendClientMessage(playerid, -1, "Choices: join, leave");
return 1;
}
if(strcmp(choice, "join", true) == 0)
{
}
else if(strcmp(choice, "leave", true) == 0)
{
}
else
{
SendClientMessage(playerid, -1, "invalid choice.");
}
return 1;
}
Any feedback would be appreciated!.