[HELP]how to make a dcmd command with multiples parameters? - 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: [HELP]how to make a dcmd command with multiples parameters? (
/showthread.php?tid=96680)
[HELP]how to make a dcmd command with multiples parameters? -
mr.b - 10.09.2009
i need help to make a commands with multiple parameters i tried with the wiki but it don't explain with multiple parameters

help please
thanks
Re: [HELP]how to make a dcmd command with multiples parameters? -
Correlli - 10.09.2009
Help yourself with sscanf.
Re: [HELP]how to make a dcmd command with multiples parameters? -
dougbrowne - 10.09.2009
example PM dcmd.
pawn Код:
dcmd_pm(playerid, params[])
{
new otherid, result[256], string[256];
if(sscanf(params, "us", otherid, result) SendClientMessage(playerid, RED, "Usage: /PM [ID] [MSG]");
// The "us" part is the format of the input. u is for username or playerid and s is for string which is the message.
else
{
format(string, sizeof(string), "PM(%d): %s", playerid, result);
SendClientMessage(otherid, YELLOW, string);
}
return 1;
}
Re: [HELP]how to make a dcmd command with multiples parameters? -
Sergei - 10.09.2009
...
Why you shouldn't make your strings 256 cells big
pawn Код:
dcmd_pm(playerid, params[])
{
new otherid, result[100], string[128];
if(sscanf(params, "us", otherid, result) SendClientMessage(playerid, RED, "Usage: /PM [ID] [MSG]");
else if(otherid == INVALID_PLAYER_ID) SendClientMessage(playerid, RED, "Error: Player not found.");
else
{
format(string, sizeof(string), "PM(%d): %s", playerid, result);
SendClientMessage(otherid, YELLOW, string);
SendClientMessage(playerid, YELLOW, string);
}
return 1;
}
You can read more about this here:
https://sampwiki.blast.hk/wiki/Fast_Commands