Please! need some help
#1

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

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

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.
Reply
#4

Setting it to true is the opposite of what they asked for, leave it as default.
Reply
#5

Ahh I misread question, my bad.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)