[Help!] Can someone please help me with my /accent command.
#2

You're using pAccent as a string. You've probably got it defined as an integer or something.

Код:
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

if(strcmp(cmd, "/Accent", true) == 0 || strcmp(cmd, "/acce", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "[HINT]  You need to login first ! ");
		new length = strlen(cmdtext);
		if(length > 64) return SendClientMessage(playerid, COLOR_GREY, "Accent is too long! ");
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		if(isnull(result)) return SendClientMessage(playerid, COLOR_GRAD2, "[USAGE] /Accent [text]");
		if(isnull(PlayerInfo[playerid][pAccent]))
		{
			strmid(PlayerInfo[playerid][pAccent], result, 0, strlen(result), 255);
			SendClientMessage(playerid, COLOR_WHITE, "[INFO] You have successfuly Set your Accent.");
		}
		else
		{
			strdel(PlayerInfo[playerid][pAccent], 0, strlen(PlayerInfo[playerid][pAccent]));
			SendClientMessage(playerid, COLOR_WHITE, "[INFO] You have successfuly removed your Accent.");
		}
	}
	return 1;
}
Reply


Messages In This Thread
[Help!] Can someone please help me with my /accent command. - by Wasim_Cortez - 19.06.2010, 11:19
Re: [Help!] Can someone please help me with my /accent command. - by bigcomfycouch - 20.06.2010, 02:03

Forum Jump:


Users browsing this thread: 1 Guest(s)