/o Command- Need "space" as delimiter?
#1

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
Reply
#2

use dcmd
Reply
#3

Quote:
Originally Posted by (ed!med!
use dcmd
And then with sscanf or still with strcmp?
Reply
#4

Код:
	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.");
		}
	}
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)