OnPlayerText callback is malfunctioning
#1

Like the title say. The callback OnPlayerText is not working. When I talk on the server it's default SA-MP chat.
What is causing this!?
pawn Код:
if (PlayerInfo[playerid][pChatMode] == 0) // By CuervO_NegrO
    {
        if(gPlayerLogged[playerid] == 0)
        {
            return 0;
        }
        if(PlayerInfo[playerid][pMuted] == 1)
        {
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
            return 0;
        }
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new playercar = GetPlayerVehicleID(playerid);
        new y1,m1,d1;
        new h1,mi1,s1;
        getdate(y1,m1,d1);
        gettime(h1,mi1,s1);
        if(!IsPlayerInAnyVehicle(playerid))
        {
            if(PlayerInfo[playerid][pAdminDuty] == 1)
            {
                format(string, sizeof(string), "Admin Says: %s", text);
                ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local Admin): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                ChatLog(string);
            }
            if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
            {
                format(string, sizeof(string), "Stranger Says: %s", text);
                ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local Masked): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                ChatLog(string);
            }
            if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
            {
                sendername[strfind(sendername,"_")] = ' ';
                format(string, sizeof(string), "%s Says: %s", sendername, text);
                ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                ChatLog(string);
            }
        }
        else
        {
            if(IsModelAPlane(playercar) || IsModelABike(playercar) || IsModelAHeli(playercar) || IsModelABoat(playercar) || IsModelASpecial(playercar))
            {

                if(PlayerInfo[playerid][pAdminDuty] == 1)
                {
                    format(string, sizeof(string), "Admin Says: %s", text);
                    ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Admin Local): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                    ChatLog(string);
                }
                if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
                {
                    format(string, sizeof(string), "Stranger Says: %s", text);
                    ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Masked Local): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                    ChatLog(string);
                }
                if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
                {
                    sendername[strfind(sendername,"_")] = ' ';
                    format(string, sizeof(string), "%s Says: %s", sendername, text);
                    ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Local): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                    ChatLog(string);
                }
            }
            else
            {
                if(VehicleWindows[GetPlayerVehicleID(playerid)] == 0)
                {

                    if(PlayerInfo[playerid][pAdminDuty] == 1)
                    {
                        format(string, sizeof(string), "(Windows Shut) Admin Says: %s", text);
                        ProxDetector(10.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Admin Windows Shut): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                    if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
                    {
                        format(string, sizeof(string), "(Windows Shut) Stranger Says: %s", text);
                        ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Masked Windows Shut): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                    if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
                    {
                        sendername[strfind(sendername,"_")] = ' ';
                        format(string, sizeof(string), "(Windows Shut) %s Says: %s", sendername, text);
                        ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Windows Shut): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                }
                else
                {

                    if(PlayerInfo[playerid][pAdminDuty] == 1)
                    {
                        format(string, sizeof(string), "(Windows Open) Admin Says: %s", text);
                        ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Admin Windows Open): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                    if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 1)
                    {
                        format(string, sizeof(string), "(Windows Open) Stranger Says: %s", text);
                        ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Masked Windows Open): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                    if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
                    {
                        sendername[strfind(sendername,"_")] = ' ';
                        format(string, sizeof(string), "(Windows Open) %s Says: %s", sendername, text);
                        ProxDetector(20.0, playerid, string,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK,COLOR_PINK);
                        format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s (Windows Open): %s",d1,m1,y1,h1,mi1,s1, sendername, text);
                        ChatLog(string);
                    }
                }
            }
        }
        return 0;
    }
Reply
#2

Do you return false at the end of OnPlayerText?
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Do you return false at the end of OnPlayerText?
Yes, but I fixed it now!
pawn Код:
sendername[strfind(sendername,"_")] = ' '; //this was the problem
This checks for an underline in the playerid's name. But I used a name that didnt have an underline, thats why the script bugged
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)