/o Command- Need "space" as delimiter? - 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: /o Command- Need "space" as delimiter? (
/showthread.php?tid=147219)
/o Command- Need "space" as delimiter? -
randomkid88 - 10.05.2010
Hello, I have made a /o command that works, however if conflicts with another command I have, /ofd. When anyone does /ofd, it shows in the OOC chat ((playername: fd)). Is there a way to make sure there is a space delimiter, so /ofd will not conflict with it? Here is the code I have:
Код:
if(!strcmp(cmdtext, "/o", true, 2)){
if(!cmdtext[2])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /o [OOC message]");
if(ServerInfo[DisableChat] ==0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, 128, "((%s: %s))", name, cmdtext[2]);
SendClientMessageToAll(lightblue, string);
}
else
{
SendClientMessage(playerid, red, "An Admin has disabled the OOC chat.");
}
}
Thanks
Re: /o Command- Need "space" as delimiter? -
Cedimedi - 10.05.2010
use dcmd
Re: /o Command- Need "space" as delimiter? -
randomkid88 - 10.05.2010
Quote:
Originally Posted by (ed!med!
use dcmd 
|
And then with sscanf or still with strcmp?
Re: /o Command- Need "space" as delimiter? -
coole210 - 11.05.2010
Код:
if(!strcmp(cmdtext, "/o", true, 2))
{
if(cmdtext[2] == 0)
{
SendClientMessage(playerid, 0xFF0000FF, "USAGE: /o [OOC message]");
return 1;
}
if(ServerInfo[DisableChat] ==0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, 128, "((%s: %s))", name, cmdtext[2]);
SendClientMessageToAll(lightblue, string);
}
else
{
SendClientMessage(playerid, red, "An Admin has disabled the OOC chat.");
}
}
Re: /o Command- Need "space" as delimiter? -
randomkid88 - 12.05.2010
Thanks for that, I just put it in and it still does the same thing as before. But I figured it out. I changed it to strtok since it collects the variable after the space.