PlayerGotSpottedRecently[playerid] = 1;
Checked[playerid] = 1;
RemoveObjects(playerid);
for (new c=0; c<13; c++) ScriptWeapons[playerid][c] = 0;
ScriptWeaponsUpdated[playerid] = 0;
SetTimerEx("ResetAcWarn", 30000, 0, "i", playerid);
SetPlayerColor(playerid,COLOR_GRAD2);
SetPVarString(playerid, "pPassword", "0") ;
SetTimerEx("CameraLogin", 100, false, "i", playerid);
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "users/%s.ini", plname);
if(INI_Exist(string)) ShowLoginDialog(playerid, DLOGIN);
else ShowRegisterDialog(playerid, DREGISTER);
SetPlayerVirtualWorld(playerid, 20);
return 1;
}
INI_Exist(filename[]) {
if (fexist(filename)) return true;
return false;
}
Esto lo tengo en OnPlayerConnect, los usuarios los tengo en SCRIPTFILES/users/user.ini, el dialogo de lo que me pide para ingresar
case DLOGIN:
{
if (response)
{
if(IsNull(inputtext))
{
ShowLoginDialog(playerid,DLOGIN);
return 1;
}
new string2[128], PlayerPass[32], playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "users/%s.ini", playername2);
INI_ParseFile(string2, "GetPlayerPass", .bExtra = true, .extra = playerid);
GetPVarString(playerid, "pPassword", PlayerPass, 32);
if(!strcmp(PlayerPass, inputtext))
{
format(string2, sizeof(string2), "users/%s.ini", playername2);
INI_ParseFile(string2, "LoadUser", false, true, playerid, true, false );
OnPlayerLogin(playerid);
}
else
{
ClearChatbox(playerid, 10);
ShowLoginDialog(playerid,DLOGIN);
Message(playerid, COLOR_WHITE, "Has introducido una contraseсa {B00000}Incorrecta");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
}
}
else
{
Kick(playerid);
}
return 1;
}