Onplayertext
#1

do i have to put else in this code? (because if i put it this way it send "Chat Is Closed" but send a message like the default message... and not what i did)
pawn Code:
public OnPlayerText(playerid, text[])
{
    if(ChatClosed == 1 && !IsPlayerAdmin(playerid) && PlayerInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, COLOR_RED, "Chat Is Closed");
    new string[256];
    if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "[Server Programmer]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_LIGHTGREEN, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 0)
    {
        format(string, sizeof(string), "%s: {FFFFFF}%s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 1)
    {
        format(string, sizeof(string), "[Activity Maneger]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_AM, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] >= 2 && PlayerInfo[playerid][AdminLevel] <= 4)
    {
        format(string, sizeof(string), "[Admin]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_ADMIN, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 5)
    {
        format(string, sizeof(string), "[Main Admin]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_ADMIN, string);
    }
    return 0;
}
Reply
#2

Remember that you have to return 0 as well as sending the client message.
Reply
#3

i remember but... look i did return 0; but still it doesnt work! it does like this:
if i want to write :"hello"
so:
The Chat is Close!
omer5198: hello
__________________
if the chat is open:
[Main Admin]omer5198(id:0): hello
Reply
#4

pawn Code:
public OnPlayerText(playerid, text[])
{
    if(ChatClosed == 1 && !IsPlayerAdmin(playerid) && PlayerInfo[playerid][AdminLevel] < 3)
    {
        SendClientMessage(playerid, COLOR_RED, "Chat Is Closed");
        return 0;
    }
    new string[256];
    if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "[Server Programmer]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_LIGHTGREEN, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 0)
    {
        format(string, sizeof(string), "%s: {FFFFFF}%s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(GetPlayerColor(playerid), string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 1)
    {
        format(string, sizeof(string), "[Activity Maneger]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_AM, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] >= 2 && PlayerInfo[playerid][AdminLevel] <= 4)
    {
        format(string, sizeof(string), "[Admin]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_ADMIN, string);
    }
    else if(PlayerInfo[playerid][AdminLevel] == 5)
    {
        format(string, sizeof(string), "[Main Admin]%s: %s [ID:%d]", GetName(playerid), text, playerid);
        SendClientMessageToAll(COLOR_ADMIN, string);
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)