08.12.2013, 21:17
I boyz, i am making a registration system with y_ini and i want that the user at his first registration can choise an team with OnPlayerRequestClass after being logged. So i have declare an global bool variable and when player connect if his file account exist i set the variable = 1 so the player can't choise more class and get spawn.
if the file not exist get start registration system.
This is the script of the login:
But when the user connect and he is already registered and haves choise his own team later login dialog he don't spawn and return to OnPlayerRequestClass, where i have write:
I hope I was clear.
please help me.
Код:
allineamento[MAX_PLAYERS]; public OnPlayerConnect(playerid) { if(fexist(FileUtente(playerid))) { allineamento[playerid] = 1; INI_ParseFile(FileUtente(playerid),"CaricaUtente_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid,D_LOGIN,DIALOG_STYLE_PASSWORD,""COL_BIANCO"Log In!",""COL_BIANCO"Bentornato!\nInserisci la password del tuo account per effettuare il Log in!","Log In","Esci"); } else { ShowPlayerDialog(playerid,D_REGISTRAZIONE,DIALOG_STYLE_PASSWORD,""COL_BIANCO"Registrazione",""COL_BIANCO"Benvenuto!\nInserisci la password per creare il tuo nuovo account!","Registrati","Esci"); } return 1; }
This is the script of the login:
Код:
if(dialogid == D_LOGIN) { // LOGIN if(!response) { Kick(playerid); } if(response) { // IF THE USER WANT LOG LATER REGISTRATION INI_ParseFile(FileUtente(playerid),"CaricaUtente_%s", .bExtra = true, .extra = playerid); if(udb_hash(inputtext) == statistiche[playerid][sPassword]) {//IF USER WANT LOG WITH NEW CONNECTION if(allineamento[playerid] == 0) /*IF BOOL VARIABLE == 0 THEN RETURN A CLIENT MESSAGE AND RETURN TO REQUEST CLASS /* { INI_ParseFile(FileUtente(playerid),"CaricaUtente_%s", .bExtra = true, .extra = playerid); SendClientMessage(playerid,-1,"[SERVER]: Ti sei loggato con successo, adesso scegli il tuo allineamento."); } if(allineamento[playerid] == -1) /* IF BOOL VARIABLE == -1 THEN RETURN A CLIENT MESSAGE AND RETURN SPAWN WITHOUT CHOISE REQUEST CLASS.. ( LATER I SCRIPT A LOAD SKIN SYSTEM AND MORE THINGS..)*/ { INI_ParseFile(FileUtente(playerid),"CaricaUtente_%s", .bExtra = true, .extra = playerid); SendClientMessage(playerid,-1,"[SERVER]: Ti sei loggato con successo"); SpawnPlayer(playerid); return 1; } } else { ShowPlayerDialog(playerid,D_LOGIN,DIALOG_STYLE_PASSWORD,""COL_BIANCO"Log In!",""COL_ROSSO"La password che hai inserito и errata!\nInserisci la password del tuo account per effettuare il Log in!","Log In","Esci"); return 0; } } }
Код:
public OnPlayerRequestClass(playerid, classid) { if(allineamento[playerid] == 0){ /* IF USER HAVEN't CHOISE HIM TEAM THEN.. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } return 1; }
please help me.