AdminChat help
#1

I have scripted an AdminChat command. But when typed in-game, nothing happens. No errors in PAWN or in Console. Here is the script

Код:
	if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0 || strcmp(cmd, "//", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
            GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[128];
			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, "{33CCFF}USAGE:{FFFFFF} (/a)dmin [admin chat]");
				return 1;
			}
			if (PlayerInfo[playerid][pAdmin] == 1) return format(string, sizeof(string), "*[Junior Administrator]%s : %s", sendername, playerid, result);
			else if (PlayerInfo[playerid][pAdmin] == 2) return format(string, sizeof(string), "*[General Administrator]%s : %s", sendername, playerid, result);
			else if (PlayerInfo[playerid][pAdmin] == 3) return format(string, sizeof(string), "*[Senior Administrator]%s : %s", sendername, playerid, result);
			else if (PlayerInfo[playerid][pAdmin] == 4) return format(string, sizeof(string), "*[Head Administraotr]%s : %s", sendername, playerid, result);
			else if (PlayerInfo[playerid][pAdmin] >= 1337) return format(string, sizeof(string), "*[Executive]%s : %s", sendername, result);
			if (PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_GRAD5, "You are not authorized to use this command");
			{
				SendAdminMessage(COLOR_GREEN, string);
			}
			printf("Admin %s: %s", sendername, result);
		}
		return 1;
	}
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
   if(text[0] == '//' && PlayerInfo[playerid][Level] >= 1) { // '//' this will be used to activate the Admin chat. //Message
   new string[128]; GetPlayerName(playerid,string,sizeof(string)); //New string, gets playername and formats string//
   format(string,sizeof(string),"[ADMIN]: %s [ID:%d] %s",string,playerid,text[1]); //Output: [ADMIN]: Name [ID]: MSG//        
   MessageToAdmins(CHOOSE_YOUR_COLOR,string); //Choose your color to your preferred color//
   return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)