Variable issue - Switch(variable
#1

FIXED
Reply
#2

Are you sure you're doing everything correctly? Something like the following:
pawn Код:
new wrongAttempts[MAX_PLAYERS char] = {0, ...};

public OnDialogResponse(..)
{
    if( ! isPasswordcorrect() )
    {
        switch( wrongAttempts{ playerid } )
        {
            case 0: First attempt;
            case 1: Second attempt;
            case 2: Third attempt; Kick();
            default: {}
        }
   
        wrongAttempts{playerid}++;
        ShowPlayerLoginDialog(..);
    }
    return 1;
}
Also, a tip - reuse the variable, certainly MAX_PLAYERS amount of players connecting at a single time is nearly impossible, so, probably 15 - 20 players at a time, so just re-use it!
Reply
#3

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Are you sure you're doing everything correctly? Something like the following:
pawn Код:
new wrongAttempts[MAX_PLAYERS char] = {0, ...};

public OnDialogResponse(..)
{
    if( ! isPasswordcorrect() )
    {
        switch( wrongAttempts{ playerid } )
        {
            case 0: First attempt;
            case 1: Second attempt;
            case 2: Third attempt; Kick();
            default: {}
        }
   
        wrongAttempts{playerid}++;
        ShowPlayerLoginDialog(..);
    }
    return 1;
}
Also, a tip - reuse the variable, certainly MAX_PLAYERS amount of players connecting at a single time is nearly impossible, so, probably 15 - 20 players at a time, so just re-use it!
No worries now man, I just didn't set the variable to 0 when the player connects got it working now, thanks anyway man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)