SA-MP Forums Archive
Local chat color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Local chat color (/showthread.php?tid=660205)



Local chat color - Mo123 - 27.10.2018

Код:
public OnPlayerText(playerid, text[])
{ 
    new message[128];

    if(PlayerInfo[playerid][pAdminDuty] == 1)
    {
        format(message, sizeof(message), "%s (( %s ))", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, COLOR_ORANGE);
    }
    else
    {
        format(message, sizeof(message), "%s says: %s", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, -1);
    }
    
    return 1;
}
Why didn't the text change to orange after i went on duty?


Re: Local chat color - ReD_HunTeR - 27.10.2018

Show Proxdetector Function


Re: Local chat color - Mo123 - 27.10.2018

Quote:
Originally Posted by ReD_HunTeR
Посмотреть сообщение
Show Proxdetector Function
Код:
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
        {
            SendClientMessage(i,color,string);
        }
    }
}



Re: Local chat color - ReD_HunTeR - 27.10.2018

thats weird, are you sure command for going onduty is setting [pAdminDuty] to "1" ?


Re: Local chat color - Mo123 - 27.10.2018

Quote:
Originally Posted by ReD_HunTeR
Посмотреть сообщение
thats weird, are you sure command for going onduty is setting [pAdminDuty] to "1" ?
Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] == 1)
    {
        new Text3D:label = Create3DTextLabel("Game Administrator", 0xFFA500FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);

        SendClientMessage(playerid, COLOR_LAWNGREEN, "You are now on duty as a Game Administrator");

        PlayerInfo[playerid][pAdminDuty] = 1;
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not a Game Administrator!");
    
    return 1;
}



Re: Local chat color - RogueDrifter - 27.10.2018

Try this:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[128];

    if(PlayerInfo[playerid][pAdminDuty] == 1)
    {
        format(message, sizeof(message), "%s (( %s ))", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, COLOR_ORANGE);
    }
    else
    {
        format(message, sizeof(message), "%s says: %s", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, -1);
    }
   
    return 0; //To stop the original message.
}



Re: Local chat color - Mo123 - 27.10.2018

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Try this:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new message[128];

    if(PlayerInfo[playerid][pAdminDuty] == 1)
    {
        format(message, sizeof(message), "%s (( %s ))", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, COLOR_ORANGE);
    }
    else
    {
        format(message, sizeof(message), "%s says: %s", GetName(playerid), text);
        ProxDetector(30.0, playerid, message, -1);
    }
   
    return 0; //To stop the original message.
}
Doesn't work

edit: im stupid i kept typing in /b