[+REP][URGENT]Help with a cmd!
#1

ok so i made 3 chats for admin chat
1st chat-for mod-juniors
2nd chat for senior-lead head admin
3rd chat for community manager-owner


So i want the 2nd chat not to be seen by the mod-juniours and 3rds chat not to be seen by the mod-lead head admin.
Here is my cmd:
Код:
CMD:admin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 1) { alevel = "Moderator"; }
			if(PlayerInfo[playerid][pAdmin] == 2) { alevel = "Junior Admin"; }
			format(string, sizeof(string), "* [MOD CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_PINK, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/mc)chat [MOD chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}

CMD:admin2(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 3) { alevel = "Senior Admin"; }
			if(PlayerInfo[playerid][pAdmin] == 4) { alevel = "Head Admin"; }
			if(PlayerInfo[playerid][pAdmin] == 1337) { alevel = "Lead Head Admin"; }
			format(string, sizeof(string), "*[ADM CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_GREEN, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/adm)in [admin chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}

CMD:admin3(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1338)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 1338) { alevel = "Community Manager"; }
			if(PlayerInfo[playerid][pAdmin] == 99999) { alevel = "Community Developer"; }
			if(PlayerInfo[playerid][pAdmin] == 100000) { alevel = "Community Owner"; }
			format(string, sizeof(string), "*[COM. ADM'S CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_BLUE, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/ca)dmin [COM. admin chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}
ANy ideas ?
Reply
#2

I don't understand, your command is /admin, and you put usage message /mc
Reply
#3

cuz i made this too
Код:
CMD:ma(playerid,params[])
{
	return cmd_admin(playerid, params);
}

CMD:ca(playerid, params[])
{
	return cmd_admin3(playerid, params);
}


CMD:adm(playerid, params[])
{
	return cmd_admin2(playerid, params);
}
nvm i now changed it into
Код:
CMD:ma(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 1) { alevel = "Moderator"; }
			if(PlayerInfo[playerid][pAdmin] == 2) { alevel = "Junior Admin"; }
			format(string, sizeof(string), "* [MOD CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_PINK, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/mc)chat [MOD chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}

CMD:adm(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 3) { alevel = "Senior Admin"; }
			if(PlayerInfo[playerid][pAdmin] == 4) { alevel = "Head Admin"; }
			if(PlayerInfo[playerid][pAdmin] == 1337) { alevel = "Lead Head Admin"; }
			format(string, sizeof(string), "*[ADM CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_GREEN, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/adm)in [admin chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}

CMD:ca(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1338)
	{
	    new msg[128];
	    new logstring[128];
		new year, month, day, hour, minute, second;
		getdate(year, month, day);
		gettime(hour, minute, second);
	    if(!sscanf(params, "s[128]", msg))
		{
			strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
			new alevel[25];
			if(PlayerInfo[playerid][pAdmin] == 1338) { alevel = "Community Manager"; }
			if(PlayerInfo[playerid][pAdmin] == 99999) { alevel = "Community Developer"; }
			if(PlayerInfo[playerid][pAdmin] == 100000) { alevel = "Community Owner"; }
			format(string, sizeof(string), "*[COM. ADM'S CHAT] %s %s: %s", alevel, sendername, msg);
            format(logstring, sizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s", day, month, year, hour, minute, second, alevel, sendername, msg);
			SendAdminMessage(COLOR_BLUE, string);
			AchatLog(logstring);
		}
		else
		{
		    SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/ca)dmin [COM. admin chat]");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
	}
	return 1;
}
Reply
#4

I'll give you an easy version, show me your SendAdminMessage, add a param level
Reply
#5

Код:
SendAdminMessage(color, string2[])
{
//	for(new i = 0; i < MAX_PLAYERS; i++)
    foreach (Player, i)
	{
		if(IsPlayerConnected(i))
		{
		    if(PlayerInfo[i][pAdmin] >= 1)
		    {
				SendClientMessage(i, color, string2);
			}
		}
	}
	return 1;
}
Reply
#6

PHP код:
SendAdminMessage(colorstring2[], level) {
    foreach (
Playeri) { if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] >= levelSendClientMessage(icolorstring2); }
    return 
1;

Usage: Example if you want to send to +1 admins(all admins) use SendAdminMessage(color, msg, 1)
if you want to send to +3 admins(don't send to 1 and 2) use SendAdminMessage(color, msg, 3)
Reply
#7

Should i edit it also in the commands and where?

EDIT: Should i just replace the old one with this one and just compile again?
Reply
#8

Yes change the old SendAdminMessage to this

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Usage: Example if you want to send to +1 admins(all admins) use SendAdminMessage(color, msg, 1)
if you want to send to +3 admins(don't send to 1 and 2) use SendAdminMessage(color, msg, 3)
Just add the new params to everywhere you used it

Well, you code becames
PHP код:
CMD:ma(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        new 
msg[128];
        new 
logstring[128];
        new 
yearmonthdayhourminutesecond;
        
getdate(yearmonthday);
        
gettime(hourminutesecond);
        if(!
sscanf(params"s[128]"msg))
        {
            
strmid(sendernamePlayerRPName(playerid), 0MAX_PLAYER_NAME);
            new 
alevel[25];
            if(
PlayerInfo[playerid][pAdmin] == 1) { alevel "Moderator"; }
            if(
PlayerInfo[playerid][pAdmin] == 2) { alevel "Junior Admin"; }
            
format(stringsizeof(string), "* [MOD CHAT] %s %s: %s"alevelsendernamemsg);
            
format(logstringsizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s"daymonthyearhourminutesecondalevelsendernamemsg);
            
SendAdminMessage(COLOR_PINKstring1);//HERE
            
AchatLog(logstring);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: (/mc)chat [MOD chat]");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"   You are not authorized to use that command !");
    }
    return 
1;
}
CMD:adm(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        new 
msg[128];
        new 
logstring[128];
        new 
yearmonthdayhourminutesecond;
        
getdate(yearmonthday);
        
gettime(hourminutesecond);
        if(!
sscanf(params"s[128]"msg))
        {
            
strmid(sendernamePlayerRPName(playerid), 0MAX_PLAYER_NAME);
            new 
alevel[25];
            if(
PlayerInfo[playerid][pAdmin] == 3) { alevel "Senior Admin"; }
            if(
PlayerInfo[playerid][pAdmin] == 4) { alevel "Head Admin"; }
            if(
PlayerInfo[playerid][pAdmin] == 1337) { alevel "Lead Head Admin"; }
            
format(stringsizeof(string), "*[ADM CHAT] %s %s: %s"alevelsendernamemsg);
            
format(logstringsizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s"daymonthyearhourminutesecondalevelsendernamemsg);
            
SendAdminMessage(COLOR_GREENstring3);//HERE
            
AchatLog(logstring);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: (/adm)in [admin chat]");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"   You are not authorized to use that command !");
    }
    return 
1;
}
CMD:ca(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1338)
    {
        new 
msg[128];
        new 
logstring[128];
        new 
yearmonthdayhourminutesecond;
        
getdate(yearmonthday);
        
gettime(hourminutesecond);
        if(!
sscanf(params"s[128]"msg))
        {
            
strmid(sendernamePlayerRPName(playerid), 0MAX_PLAYER_NAME);
            new 
alevel[25];
            if(
PlayerInfo[playerid][pAdmin] == 1338) { alevel "Community Manager"; }
            if(
PlayerInfo[playerid][pAdmin] == 99999) { alevel "Community Developer"; }
            if(
PlayerInfo[playerid][pAdmin] == 100000) { alevel "Community Owner"; }
            
format(stringsizeof(string), "*[COM. ADM'S CHAT] %s %s: %s"alevelsendernamemsg);
            
format(logstringsizeof(logstring), "[%d/%d/%d - %d:%d:%d] * %s %s"daymonthyearhourminutesecondalevelsendernamemsg);
            
SendAdminMessage(COLOR_BLUEstring,1338);//HERE
            
AchatLog(logstring);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: (/ca)dmin [COM. admin chat]");
        }
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"   You are not authorized to use that command !");
    }
    return 
1;

Reply
#9

Код:
E:\****\gamemodes\****.pwn(27190) : error 029: invalid expression, assumed zero
E:\****\gamemodes\****.pwn(27190) : warning 215: expression has no effect
E:\****\gamemodes\****.pwn(27190) : warning 215: expression has no effect
E:\****\gamemodes\****.pwn(27190) : error 001: expected token: ";", but found ")"
E:\****\gamemodes\****.pwn(27190) : error 029: invalid expression, assumed zero
E:\****\gamemodes\****.pwn(27190) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
The lines
Код:
format(string, sizeof(string), "Whisper to %s(ID: %d): %s", PlayerRPName(giveplayerid), giveplayerid, (result));
	SendClientMessage(playerid,  COLOR_YELLOW, string);
	if(PlayerInfo[playerid][pAdmin] == 0 && GetDistanceBetweenPlayers(playerid,giveplayerid) <= 6)
	{
	    format(string, sizeof(string), "%s(ID: %d) whispers: %s", PlayerRPName(playerid), playerid, (result));
		SendClientMessage(giveplayerid, COLOR_YELLOW, string);
     	if(AwaitingHelp[giveplayerid] == 1 && PlayerInfo[playerid][pAdmin] >= 1)
	    {
	    format(string2, sizeof(string2), "{FF0000}AdmWarning{FFFFFF}: %s %s has answered %s (ID: %d):", alevel, PlayerRPName(playerid),PlayerRPName(giveplayerid) ,giveplayerid);
	    SendAdminMessage(0xFFFFFFAA, string2, 1);
	    format(string2, sizeof(string2), "ANSWER: %s", (result));
	    SendAdminMessage(0xFF6347AA,, string2, 1); //27190
		}
		AwaitingHelp[giveplayerid] = 0;
		return 1;
	}
Reply
#10

SendAdminMessage(0xFF6347AA,, string2, 1);


You have two commas on tht line

change it to this

SendAdminMessage(0xFF6347AA, string2, 1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)