[Help] How do Command [text] [text] - 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 do Command [text] [text] (
/showthread.php?tid=222292)
[Help] How do Command [text] [text] -
nutzkung69 - 07.02.2011
i want to do command /setname [playerid] [text] [text] / but I don't know how to do
Simple Command
/setname [playerid] [text] [text]
this command is setname to rpname
Sorry for my bad english
Plase Help ^^"
Re: [Help] How do Command [text] [text] -
Backwardsman97 - 07.02.2011
Have you tried dcmd and sscanf? I'm sure there's probably faster command processors now. I've been outta SA-MP for a while.
Re: [Help] How do Command [text] [text] -
On_Top_Non_Stop - 07.02.2011
Quote:
Originally Posted by Backwardsman97
Have you tried dcmd and sscanf? I'm sure there's probably faster command processors now. I've been outta SA-MP for a while.
|
Yea, Zcmd.
As Backwardsman97 said, learn to use Zcmd/dcmd together with sscanf. Both can be found by searching.
Re: [Help] How do Command [text] [text] -
fangoth1 - 07.02.2011
Here, this is made with STRTOk
pawn Код:
if (strcmp("/setname", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setname[player id] [name]");
new playeree = strval(tmp);
if(!IsPlayerConnected(playeree)) return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected.");
new tmp2[128];
tmp2 = strtok(cmdtext, idx);
if(strlen(tmp2) == 0) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setname[player id] [name]");
new name[50];
format(name, 50, cmdtext[10 + strlen(tmp)]);
new playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
GetPlayerName(playeree, playername, MAX_PLAYER_NAME);
GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
SetPlayerName(playeree, name);
format(string, sizeof(string), "Admin %s has set %s name to %s", adminname, playername, name);
SendClientMessageToAll(COLOR_RED, string);
}
else if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You Are Not A Admin");
}
return 1;
}