Help me, i don't know how to do.. - 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: Help me, i don't know how to do.. (
/showthread.php?tid=480099)
Help me, i don't know how to do.. -
Galletziz - 08.12.2013
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.
Код:
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;
}
if the file not exist get start registration system.
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;
}
}
}
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:
Код:
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;
}
I hope I was clear.
please help me.
Re: Help me, i don't know how to do.. -
DanishHaq - 08.12.2013
You need to use a savable variable for this, global / boolean variables will only be saved on the player's IP;
Player A connects
Player A buys a phone, and is set on the global variable
Player A disconnects
Player B connects on the same ID that player A was on
Player B already has a phone