SA-MP Forums Archive
OnPlayerText problem - 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: OnPlayerText problem (/showthread.php?tid=357954)



OnPlayerText problem - Jstylezzz - 08.07.2012

Hi everyone,

I have this code, but when i type anything, it returns all...
pawn Код:
if(IsCallingATaxi[playerid] == 1)
    {
    if(strcmp(text, "yes", true, strlen(text)))
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: Okay then, a taxi is coming your way soon, please wait patiently till your call is accepted!");
    return 1;
    }
    if(strcmp(text, "no", true, strlen(text)))
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: okay then, have a good day!");
    HangUpPhone(playerid);
    return 1;
    }
    else
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: Excuse me? Yes or no?");
    return 1;
    }
    }
anyone sees the problem??


Re: OnPlayerText problem - Vince - 08.07.2012

Strcmp returns 0 on success.


Re: OnPlayerText problem - SnG.Scot_MisCuDI - 08.07.2012

replace
pawn Код:
return 1;
with
pawn Код:
return 0;



Re: OnPlayerText problem - FireCat - 08.07.2012

pawn Код:
if(IsCallingATaxi[playerid] == 1)
    {
    if(!strcmp(text, "yes", true, strlen(text)))
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: Okay then, a taxi is coming your way soon, please wait patiently till your call is accepted!");
    return 1;
    }
    if(!strcmp(text, "no", true, strlen(text)))
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: okay then, have a good day!");
    HangUpPhone(playerid);
    return 1;
    }
    else
    {
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Cellphone: Excuse me? Yes or no?");
    return 1;
    }
    }



Re: OnPlayerText problem - Jstylezzz - 08.07.2012

thanks both, i will try now

EDIT: now it's working, but my text is orange and goes to all players....
EDIT2: NVM problem fixed, thanks both


Re: OnPlayerText problem - SnG.Scot_MisCuDI - 08.07.2012

Refer to this for future:
https://sampwiki.blast.hk/wiki/Strcmp