SA-MP Forums Archive
[Help] OnPlayerText Error.. - 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: [Help] OnPlayerText Error.. (/showthread.php?tid=509381)



[Help] OnPlayerText Error.. - juandiegox - 26.04.2014

Hi all friends forum samp, well I have a problem with OnPlayerText functions, the problem is that to get into my server and write any word says that no one on the phone and see written twice, I hope you can help me thanks from now, I leave some images and script ..



pawn Код:
public OnPlayerText(playerid, text[])
{
   new string[100];
   format(string, sizeof(string), "%s Say: %s",NombreJugador(playerid), text);
   if(Mobile[playerid] != INVALID_PLAYER_ID)
    {
            format(string, sizeof(string), "{B9FF93}[Telephone] Testing{FFFFFF}: %s", text);
        }
        ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        // -============================ · ============================- //
        ProxDetector(10.0, playerid, string,Hablar,Hablar2,Hablar3,Hablar4,Hablar5);
        if(IsPlayerConnected(Mobile[playerid]))
        {
            if(Mobile[Mobile[playerid]] == playerid)
            {
                if(InfoJugador[Mobile[playerid]][pSpeaker] != 0)
                {
                    format(string, sizeof(string), "[Speaker] %s Say: %s", SacarNombre(playerid), text);
                    ProxDetector(20.0, Mobile[playerid], string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
                }
                else
                {
                    SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW,"No one on the phone!");
        }
        return 0;
    }
this is the function OnPlayerText completed..

Thanks beforehand, and I hope they can help me ..

PD: Sorry for the spanish in script or in the server >.<


Re: [Help] OnPlayerText Error.. - Zex Tan - 26.04.2014

pawn Код:
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        // -============================ · ============================- //
        ProxDetector(10.0, playerid, string,Hablar,Hablar2,Hablar3,Hablar4,Hablar5);
This line is your problem I believe. So to fix it, put the ProxDetector into the formatted string for telephone and it should be fine and leave the second one where it should be.


Re: [Help] OnPlayerText Error.. - juandiegox - 26.04.2014

Quote:
Originally Posted by Zex Tan
Посмотреть сообщение
pawn Код:
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        // -============================ · ============================- //
        ProxDetector(10.0, playerid, string,Hablar,Hablar2,Hablar3,Hablar4,Hablar5);
This line is your problem I believe. So to fix it, put the ProxDetector into the formatted string for telephone and it should be fine and leave the second one where it should be.
I do not understand Might explain better?


Re: [Help] OnPlayerText Error.. - juandiegox - 26.04.2014

Oh Ok, i understand, problem solved, thank you!


Re: [Help] OnPlayerText Error.. - Zex Tan - 26.04.2014

So basically you have 2 ProxDetector line at OnPlayerText. So you'll need to put the first ProxDetector into the 'Mobile[playerid] != INVALID_PLAYER_ID'.

So it would be come like this:
pawn Код:
if(Mobile[playerid] != INVALID_PLAYER_ID)
    {
            format(string, sizeof(string), "{B9FF93}[Telephone] Testing{FFFFFF}: %s", text);
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }