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=435568)



OnPlayerText problem. - Rayan_black - 07.05.2013

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;
}



Re: OnPlayerText problem. - Babul - 07.05.2013

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


Re: OnPlayerText problem. - f0cus - 07.05.2013

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"


Re: OnPlayerText problem. - MP2 - 07.05.2013

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


Re : OnPlayerText problem. - Rayan_black - 07.05.2013

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