need help with helper chat.
#1

i want admins can also talk at /hc even they are not helpers...

here is the codes :
Код:
CMD:hc(playerid, params[])
{
	if(PlayerInfo[playerid][pHelper] < 1)
	{
	    return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	}
	if(isnull(params))
	{
	    return SendClientMessage(playerid, COLOR_GREY3, "[Usage]: /hc [helper chat]");
	}
	if(PlayerInfo[playerid][pToggleHelper])
	{
	    return SendClientMessage(playerid, COLOR_GREY, "You can't speak in the helper chat as you have it toggled.");
	}

	foreach(new i : Player)
	{
	    if(PlayerInfo[i][pHelper] > 0 && !PlayerInfo[i][pToggleHelper])
	    {
	        if(strlen(params) > MAX_SPLIT_LENGTH)
	        {
	            SendClientMessageEx(i, COLOR_AQUA, "** %s %s: %.*s... **", GetHelperRank(playerid), GetPlayerRPName(playerid), MAX_SPLIT_LENGTH, params);
	            SendClientMessageEx(i, COLOR_AQUA, "** %s %s: ...%s **", GetHelperRank(playerid), GetPlayerRPName(playerid), params[MAX_SPLIT_LENGTH]);
			}
			else
			{
				SendClientMessageEx(i, COLOR_AQUA, "** %s %s: %s **", GetHelperRank(playerid), GetPlayerRPName(playerid), params);
			}
		}
	}

	return 1;
}
Reply
#2

try this
PHP код:
CMD:hc(playeridparams[])
{
    if(
PlayerInfo[playerid][pHelper] < || PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(
isnull(params)) return SendClientMessage(playeridCOLOR_GREY3"[Usage]: /hc [helper chat]");
    if(
PlayerInfo[playerid][pToggleHelper]) return SendClientMessage(playeridCOLOR_GREY"You can't speak in the helper chat as you have it toggled.");
    foreach(new 
Player)
    {
        if(
PlayerInfo[i][pHelper] > && !PlayerInfo[i][pToggleHelper] && PlayerInfo[i][pAdmin] > 0)
        {
            if(
strlen(params) > MAX_SPLIT_LENGTH)
            {
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: %.*s... **"GetHelperRank(playerid), GetPlayerRPName(playerid), MAX_SPLIT_LENGTHparams);
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: ...%s **"GetHelperRank(playerid), GetPlayerRPName(playerid), params[MAX_SPLIT_LENGTH]);
            }
            else
            {
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: %s **"GetHelperRank(playerid), GetPlayerRPName(playerid), params);
            }
        }
    }
    return 
1;

Reply
#3

now saying "You are not authorized to use this command." i am lvl 7 admin.
Reply
#4

Try it:

PHP код:
if(!(PlayerInfo[playerid][pHelper] > || PlayerInfo[playerid][pAdmin] > 1))
{
    return 
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");

Reply
#5

PHP код:
if(PlayerInfo[playerid][pHelper] < && PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command."); 
Reply
#6

no message when i type /hc Hello
Reply
#7

but helpers can see my message but i can't see their Message....
Reply
#8

change this

PHP код:

    
foreach(new Player)
    {
        if(
PlayerInfo[i][pHelper] > && !PlayerInfo[i][pToggleHelper] || PlayerInfo[i][pAdmin] > 0)
        {
            if(
strlen(params) > MAX_SPLIT_LENGTH)
            {
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: %.*s... **"GetHelperRank(playerid), GetPlayerRPName(playerid), MAX_SPLIT_LENGTHparams);
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: ...%s **"GetHelperRank(playerid), GetPlayerRPName(playerid), params[MAX_SPLIT_LENGTH]);
            }
            else
            {
                
SendClientMessageEx(iCOLOR_AQUA"** %s %s: %s **"GetHelperRank(playerid), GetPlayerRPName(playerid), params);
            }
        }
    } 
and give a try
Reply
#9

worked thanks Both of you +Rep.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)