Please! need some help - 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: Please! need some help (
/showthread.php?tid=662458)
Please! need some help -
sage12 - 02.01.2019
hi , i want to if a player typed TEsT for exp its get this mssg:
[server] hi (exp)
i mean if he typed exacly what i want , so if he typed teSt or TesT show noting , it should detect capital words ! what exacly i say , TEsT ! how should i do that!?
Thanks.
Re: Please! need some help -
AhmedMohamed - 02.01.2019
Check this out:
https://sampwiki.blast.hk/wiki/Tolower
Is that what you need?
pawn Код:
public OnPlayerText(playerid, text[])
{
new string1[128],string2[128];
for(new i=0;i<strlen(text);i++) string2[i]=tolower(text[i]);
format(string1, sizeof(string1), "Hi %s", string2);
SendClientMessage(playerid, 0xFFFFFF, string1);
return 1;
}
Re: Please! need some help -
SyS - 02.01.2019
strcmp has a parameter to ignore case
Код:
strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax)
set it to true..
for example
PHP код:
if(!strcmp(stringvar,"test",true)){
}
Edit: I misread the question.You want to compare if entered text is exactly equal to "TEsT" in that case leave default value as it is.
PHP код:
if(!strcmp(stringvar,"TEsT")){
}
https://sampwiki.blast.hk/wiki/Strcmp
Note: above one checks if the text is entirely equal to TEsT and i guess that's what you want.
Re: Please! need some help -
Y_Less - 02.01.2019
Setting it to true is the opposite of what they asked for, leave it as default.
Re: Please! need some help -
SyS - 03.01.2019
Ahh I misread question, my bad.