OnPlayerText problem
#1

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??
Reply
#2

Strcmp returns 0 on success.
Reply
#3

replace
pawn Код:
return 1;
with
pawn Код:
return 0;
Reply
#4

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;
    }
    }
Reply
#5

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
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)