SA-MP Forums Archive
Variable issue - Switch(variable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Variable issue - Switch(variable (/showthread.php?tid=492485)



Variable issue - Switch(variable - ross8839 - 04.02.2014

FIXED


Re: Variable issue - Switch(variable - RajatPawar - 04.02.2014

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!


Re: Variable issue - Switch(variable - ross8839 - 04.02.2014

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