Error with /Announce CMD
#1

Hi everyone,
When I type the /announce command, and after that a message, it shows only until the first space, and that's it.
here is the Code:
Код:
if(strcmp(cmd, "/announce", true) == 0 || strcmp(cmd, "/ann", true) == 0)
	{
	    if(PlayerInfo[playerid][pAdminLevel] >= gCommands[ANNOUNCE])
	    {
	    	new tmp[256], string[150];
	    	tmp = strtok(cmdtext, idx);
	    	if(!strlen(tmp)){ return SendClientMessage(playerid, COLOR_LIGHTCYAN, "./announce | /ann [txt]"); }
	    	format( string, sizeof(string), "~g~%s", tmp);
	    	GameTextForAll(string, 5000, 5);
	    }
	    
	return 1;
	}
Thank you very much!
Reply
#2

Anyone ?
Reply
#3

Код:
	if(strcmp(cmd, "/announce", true) == 0 || strcmp(cmd, "/ann", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pAdminLevel] >= gCommands[ANNOUNCE])
			{
				new length = strlen(cmdtext);
				while ((idx < length) && (cmdtext[idx] <= ' '))
				{
					idx++;
				}
				new offset = idx;
				new result[96];
				while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
				{
					result[idx - offset] = cmdtext[idx];
					idx++;
				}
				result[idx - offset] = EOS;
				if(!strlen(result))
				{
					SendClientMessage(playerid, COLOR_LIGHTCYAN, "./announce | /ann [txt]");
					return 1;
				}
				format(string, sizeof(string), "~g~%s",result);
                                GameTextForAll(string, 5000, 5);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
				return 1;
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)