SA-MP Forums Archive
Chat problems - 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: Chat problems (/showthread.php?tid=513636)



Chat problems - Dziugsas - 17.05.2014

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;
}



Re: Chat problems - AroseKhanNiazi - 17.05.2014

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


Re: Chat problems - Dziugsas - 17.05.2014

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


Re: Chat problems - Threshold - 17.05.2014

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;
}



Re: Chat problems - Dziugsas - 17.05.2014

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