Chat problems
#1

Hello guys!

Haven't been here for a while .

I'm encountering the problem.Everything is working fine:
  1. The colors
  2. Chat bubble
  3. Animation
  4. And range
But it doesn't send any message :/.Why is that?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        new Length = strlen(text);
        new aTime = Length*200;
        ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,1,1,1,0,aTime);
    }
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        SetPlayerChatBubble(playerid, text, COL_ADMINGREEN, 50.0, 4000);
        return 0;
    }
    else if(PlayerInfo[playerid][pAdmin] == 0)
    {
        SetPlayerChatBubble(playerid, text, COL_WHITE, 50.0, 4000);
        return 0;
    }
    new name[MAX_PLAYER_NAME],string[150],Float:X,Float:Y,Float:Z;
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, X, Y, Z);
    format(string, sizeof(string), ""TCWHITE"["TCRED"%s"TCRED"]: "TCCYAN"%s", name, text[0]);
    strreplace(name, '_', ' ');
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(IsPlayerInRangeOfPoint(i, 5, X, Y, Z))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                SendClientMessage(i,COL_ADMINGREEN,string);
                return 1;
            }
            else if(PlayerInfo[playerid][pAdmin] == 0)
            {
                SendClientMessage(i,COL_WHITE,string);
                return 1;
            }
        }
    }
    return 0;
}
Reply
#2

you are returning 0 so no chat message he typed will be send ed
Reply
#3

I made it return 1; still the same.I already tried that.
Reply
#4

I'm assuming this is what you want.
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(!IsPlayerInAnyVehicle(playerid)) ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,1,1,1,0, (strlen(text) * 200));
    SetPlayerChatBubble(playerid, text, (PlayerInfo[playerid][pAdmin]) ? (COL_ADMINGREEN) : (COL_WHITE), 50.0, 4000);
    new name[MAX_PLAYER_NAME], string[150], Float:X, Float:Y, Float:Z;
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, X, Y, Z);
    format(string, sizeof(string), ""TCWHITE"["TCRED"%s"TCWHITE"]: "TCCYAN"%s", name, text[0]);
    strreplace(name, '_', ' ');
    for(new i = 0; i < MAX_PLAYERS; ++i)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInRangeOfPoint(i, 5.0, X, Y, Z)) SendClientMessage(i, (PlayerInfo[playerid][pAdmin]) ? (COL_ADMINGREEN) : (COL_WHITE), string);
    }
    return 0;
}
Reply
#5

Thanks for reply ,but i now i have another problem https://sampforum.blast.hk/showthread.php?tid=513661
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)