Some Errors; Help, Please? :)
#7

This should work:

Код:
//----------------------------------[Staff Chat]-----------------------------------------------
if(strcmp(cmdtext, "//", true) == 0 || strcmp(cmdtext, "/staffchat", true) == 0)
{
	if(PlayerInfo[playerid][pAdmin]<1) return SendClientMessage(playerid, COLOR_GRAD2, "You are not authorised to do that!");
	
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);

	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(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (//) [text]");
		return 1;
	}
	
	if(PlayerInfo[playerid][pAdmin] >= 0)
	{
		if(PlayerInfo[playerid][pAdmin] == 1) { format(string, sizeof(string), "[STAFF CHAT] (Admin 1) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 2) { format(string, sizeof(string), "[STAFF CHAT] (Admin 2) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 3) { format(string, sizeof(string), "[STAFF CHAT] (Senior Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 4) { format(string, sizeof(string), "[STAFF CHAT] (Lead Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 5) { format(string, sizeof(string), "[STAFF CHAT] (Head Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 6) { format(string, sizeof(string), "[STAFF CHAT] (Owner) %s: %s", sendername, result); }
	}
	if(PlayerInfo[playerid][pGM] >= 0)
	{
		if(PlayerInfo[playerid][pGM] == 1) { format(string, sizeof(string), "[STAFF CHAT] (Trial GM) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 2) { format(string, sizeof(string), "[STAFF CHAT] (GM 1) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 3) { format(string, sizeof(string), "[STAFF CHAT] (GM 2) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 4) { format(string, sizeof(string), "[STAFF CHAT] (Senior GM) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 5) { format(string, sizeof(string), "[STAFF CHAT] (Lead GM) %s: %s", sendername, result); }
	}
	
	SendClientMessageToAll(COLOR_ORANGE, string);
	return 1;
}
Код:
//----------------------------------[Staff Announcement]-----------------------------------------------
if(strcmp(cmdtext, "/sann", true) == 0)
{
	if((PlayerInfo[playerid][pAdmin] < 1) || (PlayerInfo[playerid][pGM] < 3)) return SendClientMessage(playerid,0xffffffaa,"You are not authorised to do that!");

	GetPlayerName(playerid, sendername, sizeof(sendername));
	new length = strlen(cmdtext);
	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(!strlen(result))
	{
		SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/sann) [text]");
		return 1;
	}
	SendClientMessageToAll(COLOR_WHITE, "|____________**Staff Announcement**____________|");
	
	if(PlayerInfo[playerid][pAdmin] >= 0)
	{
		if(PlayerInfo[playerid][pAdmin] == 1) { format(string, sizeof(string), "(Administrator) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 2) { format(string, sizeof(string), "(Administrator) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 3) { format(string, sizeof(string), "(Senior Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 4) { format(string, sizeof(string), "(Lead Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 5) { format(string, sizeof(string), "(Head Admin) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pAdmin] == 6) { format(string, sizeof(string), "(Owner) %s: %s", sendername, result); }
	}
	if(PlayerInfo[playerid][pGM] >= 3)
	{
		if(PlayerInfo[playerid][pGM] == 3) { format(string, sizeof(string), "(Game Master) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 4) { format(string, sizeof(string), "(Senior GM) %s: %s", sendername, result); }
		else if(PlayerInfo[playerid][pGM] == 5) { format(string, sizeof(string), "(Lead GM) %s: %s", sendername, result); }
	}
	SendClientMessageToAll(COLOR_OOC2, string);
	return 1;
}
Reply


Messages In This Thread
Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 05:57
Re: Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 06:18
Re: Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 07:31
Re: Some Errors; Help, Please? :) - by Flashy - 15.06.2010, 07:39
Re: Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 07:45
Re: Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 07:53
Re: Some Errors; Help, Please? :) - by DJDhan - 15.06.2010, 09:20
Re: Some Errors; Help, Please? :) - by Tnt12340 - 15.06.2010, 09:28

Forum Jump:


Users browsing this thread: 2 Guest(s)