OnPlayerText problem.
#1

Well, there's a little problem it supposed to be when I write "HESOYAM" it gives me the reward, but something is wrong cause if I only write "h" it gives me the reward here's the lines

pawn Код:
if(strcmp("hesoyam",text,false,1) == 0 &&  CanUseCheats[playerid] == true)
{
    cmd_hesoyam(playerid, "");
    return 0;
 }
//=====================cmd=====================
CMD:hesoyam(playerid, params[])
{
    SetPlayerArmour(playerid, 100);
    SetPlayerHealth(playerid, 100);
    GivePlayerMoney(playerid, 250000);
    CheatTD(playerid);
    return 1;
}
Reply
#2

if(strcmp("hesoyam",text,false,7)
...cause the stringlenght of "hesoyam" is 7.
Reply
#3

if(strcmp("hesoyam",text,false,7) == 0 && CanUseCheats[playerid] == true)
{
cmd_hesoyam(playerid, "");
return 0;
}
//=====================cmd=====================
CMD:hesoyam(playerid, params[])
{
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
GivePlayerMoney(playerid, 250000);
CheatTD(playerid);
return 1;
}

<...text,false,NUMBER) the numer is lenght. Example if you write "text,false,5)" then, you can use "hesoy"
Reply
#4

Just remove the length parameter from strcmp - it's not necessary.
Reply
#5

I acually didn't notice that, how dum I am... thanks guys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)