Checking if a string is empty, shouldn't this do it?
#1

pawn Код:
if(strcmp(password, inputtext, false) == 0)
            {
I may be ill informed, but shouldn't a returned 0 strcmp return 0?

If I hit enter, it allows access to the server without a password! (MAJOR EXPLOIT!)

Thanks for any assistance.
Reply
#2

PHP код:
if(udb_hash(inputtext) == PlayerInfo[playerid][Password])// THIS HASHES THE PASSWORD, BE SURE TO HAVE WHIRLPOOL
{
    
GivePlayerMoney(playeridPlayerInfo[playerid][Money]); // GIVES MONEY
    
SpawnPlayer(playerid); // SPAWNS PLAYER
}
else
{
    
ShowLoginDialog(playerid); // RESHOWS YOUR DIALOG, CHANGE IF NEEDED
    
SendClientMessage(playeridGREY"[SERVER]: You have entered an incorrect password."); // SAYS INCORRECT PW
    
LoginAttempt[playerid] ++; //ADDS A LOGIN ATTEMPT
    
if(LoginAttempt[playerid] == 2// TO MANY AND HE'S KICKED
    
{
    
LoginAttempt[playerid] = 0;
    
Kick(playerid);
    }

Reply
#3

Strcmp returns 0 when the input MATCHES. You should use:

pawn Код:
if(!strlen(password) || isnull(password))
You should have isnull if you have ZCMD.
Reply
#4

isnull is more efficient than strlen.
Reply
#5

Thanks for the responses, I appreciate it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)