[Help] About Check Case Insensitive
#1

I have some question about "check case insensitive"

... well i will give example, if name of player is Player_One, on /offlineban i type /offlineban player_one, he is banned.

another example,if race for load is name Las Venturas Race, if i type /loadrace las venturas race, he will load it..

if you understand me?... how can i fix that...
Reply
#2

pawn Код:
if(!strcmp(string1, string2, false))
{
    // String1 and String 2 are same (case matters)
    // "Las Venturas Race" is same as "Las Venturas Race"
}
else
{
    // they're not the same
    // "Las Venturas Race" is not same as "las venturas race"
}
Reply
#3

hmm im really confused about that, can you show me in this cmd ?

Код:
CMD:offban(playerid, params[])
{
	new igr[64],rzl[64],banfile[64];
	new string[128];
	new lokacija[128];
	if(PlayerInfo[playerid][pAdmin] < 1337) return SCM(playerid,Crvena,"{B5B5B5}[!{FF0000}SaboAC{B5B5B5}] {FFFFFF}you cant do that!");
	if(sscanf(params,"s[40]s[40]", igr, rzl)) return SCM(playerid,Crvena,"use: {FFFFFF}/offban [NICK] [reason]");
	format(lokacija,128,"Users/%s.ini",igr);
 	if(!fexist(lokacija)) return SCM(playerid,Crvena," SaboAC{FFFFFF} Nick doesnt exist!");
 	//rest of code bla bla....
 	return 1;
}
Reply
#4

Hold on, I'm now confused on what you need. Do you want to prevent someone from using for example lowercase instead of the name itself (uppercase + lowercase)?

Example: "/offban david" would not be the same as "/offban David"?
Reply
#5

Yes, i want something like this

/offban David - (David is Banned)
/offban david - (Account doesn't exist)

understand? XD
Reply
#6

Alright, from what I see.. in fopen, case does not matter. In case, you're using something like Dini or any other include, I'm not sure if it will work because you'll have to change it.

An example with simple file.inc

pawn Код:
main( )
{
    new File:example = fopen("FILE.TXT", io_read);
    // A file called file.txt (lowercase) and it's located in scriptfiles
    if(example)
    {
        if(!strcmp("FILE.TXT", "file.txt", false))
        {
            print("The file was found and it does match!");
            fclose(example);
        }
        else print("The file was found, but it does not match in the letters case.");
    }
}
The output was: The file was found, but it does not match in the letters case.
Reply
#7

Hmmm, i think that will work, very thanks... i will post if dont work thanks !!! rep+
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)