Turning uppercase to lowercase? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Turning uppercase to lowercase? (
/showthread.php?tid=459312)
Turning uppercase to lowercase? -
Rokzlive - 22.08.2013
I made a function to turn md5 hashes like 5D41402ABC4B2A76B9719D911017C592 to 5d41402abc4b2a76b9719d911017c592.
Essentially all it does it make it lowercase. For some reason though, its making funky things like this: И””Ђ
Heres the function and the string in which i call it.
pawn Код:
stock Lowercase(text[])
{
for(new i; i< 32; i++)
{
text[i] = tolower(text[i]);
}
return text;
}
format(query,sizeof(query),"SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%s' LIMIT 1",PlayerName(playerid),Lowercase(MD5_Hash(string)));
Final Query: [23:09:23] CMySQLHandler::Query(SELECT * FROM `users` WHERE `username` = 'Whatcha' AND `password` = 'И””Ђ' LIMIT 1) - Successfully executed.
Re: Turning uppercase to lowercase? -
Scenario - 22.08.2013
Use prints after the tolower() line to determine if the character is going lowercase or not.
Re: Turning uppercase to lowercase? -
whatthefuck123 - 22.08.2013
wrong section.. b
Re: Turning uppercase to lowercase? -
Rokzlive - 22.08.2013
@whatthefuck123 Sorry. Didnt realize that. I was really tired at the time.
Quote:
Originally Posted by RealCop228
Use prints after the tolower() line to determine if the character is going lowercase or not.
|
I did a short debug and heres the result.
Function:
pawn Код:
stock Lowercase(text[])
{
print(text);
for(new i; i< 32; i++)
{
text[i] = tolower(text[i]);
}
print(text);
return text;
}
Under OnGamemodeInit:
pawn Код:
print(Lowercase(MD5_Hash("Hello")));
Final Result:
[18:55:18] 8B1A9953C4611296A827ABF8C47804D7 (First print in Lowercase function)
[18:55:18] 8b1a9953c4611296a827abf8c47804d7 (Second print in lowercase function)
[18:55:18] **Unarmed (Print under OnGamemodeInit)
Its erroring in the return...