I Need Help, again - 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: I Need Help, again (
/showthread.php?tid=298035)
I Need Help, again -
Cody_Maverak - 19.11.2011
Hello all!
I was working on a PM command and it works. However, it can only send 1 word at a time. Can you guys help me out again?
Thank You,
Cody Maverak
Re: I Need Help, again -
Elka_Blazer - 19.11.2011
LOL You cant make chat commands with strtok !!!!
you need the stock of strrest or more recommended is to use sscanf2
!!!
Re: I Need Help, again -
CSSI - 19.11.2011
still stuck in strtok? switch to sscanf.
Re: I Need Help, again -
Cody_Maverak - 19.11.2011
so how would i do this in sscanf?
Re: I Need Help, again -
FuTuяe - 19.11.2011
Have fun, it's in zcmd btw.
pawn Код:
COMMAND:pm(playerid, params[])
{
new targetid, string[128], message[128];
if(sscanf(params,"uS(No message specified)[128]",targetid,message)) return SendClientMessage(playerid,SERVER_ORANGE," Correct usage is /pm [ name/id ] [ message ].");
format(string, sizeof(string),"[ Received PM ] %s[%d]: %s",Player[playerid][name],playerid,message);
SendClientMessage(targetid,PLAYER_COLOR_YELLOW,string);
format(string, sizeof(string),"[ Sent PM ] %s[%d]: %s",Player[targetid][name],targetid,message);
SendClientMessage(playerid,PLAYER_COLOR_YELLOW,string);
return true;
}