25.09.2014, 01:44
Код:
function SafeLogin(playerid)
{
ClearChatbox(playerid);
TextDrawHideForPlayer(playerid, cargando);
TextDrawHideForPlayer(playerid, looking);
TextDrawHideForPlayer(playerid, box);
SetPlayerJoinCamera(playerid);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
LoginTimer[playerid] = SetTimerEx("TimerLogin",30000,0,"d",playerid);
if(INI_Exist(playername))
{
gPlayerAccount[playerid] = 1;
ShowMainMenuDialog(playerid, 1);
return 1;
}
else
{
if(strfind( playername, "_", true) == -1)
{
SetPlayerName(playerid, "InvalidNick");
SendClientMessageEx(playerid, COLOR_WHITE, "Porfavor usa el formato correcto: Nombre_Apellido");
SendClientMessageEx(playerid, COLOR_WHITE, "Vuelve a entrar con el formato indicado." );
Kick(playerid);
}
else
{
gPlayerAccount[playerid] = 0;
ShowMainMenuDialog(playerid, 2);
}
return 1;
}
}
ShowMainMenuDialog(playerid, frame)
{
new titlestring[28];
new string[256];
InsideMainMenu[playerid] = true;
switch(frame)
{
case 1:
{
INI_ParseFile(UserPath(playerid), "LoadUser_pass", .bExtra = true, .extra = playerid);
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Esta cuenta estб registrada", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Ingresa tu contraseсa:", ip);
SafeDialogEx(playerid,DLOGIN,DIALOG_STYLE_PASSWORD ,titlestring,string,"Entrar","Salir");
SetPlayerVirtualWorld(playerid, 20);
}
case 2:
{
new ip[32];
GetPlayerIp(playerid, ip, 32);
format(titlestring, sizeof(titlestring), "Registra una nueva cuenta", GetPlayerNameEx(playerid));
format(string, sizeof(string), "Contraseсa:", ip);
SafeDialogEx(playerid,DREGISTER,DIALOG_STYLE_INPUT ,titlestring,string,"Registrar","Salir");
SetPlayerVirtualWorld(playerid, 20);
}
}
}
ShowMenuLogin(playerid)
{
ClearChatbox(playerid);
new string[128];
for(new i = 0; i < 9; i++)
{
TextDrawShowForPlayer(playerid, LoginMenu[i]);
}
TextDrawShowForPlayer(playerid, cargando);
TextDrawShowForPlayer(playerid, looking);
TextDrawShowForPlayer(playerid, box);
TextDrawHideForPlayer(playerid, VortexZone);
TextDrawSetString(MOTD, string);
TextDrawShowForPlayer(playerid, MOTD);
TextDrawSetString(LoginMenu[8], string);
return 1;
}
HideMenuLogin(playerid)
{
TextDrawHideForPlayer(playerid, MOTD);
for(new i = 0; i < 9; i++) { TextDrawHideForPlayer(playerid, LoginMenu[i]); }
TextDrawShowForPlayer(playerid, VortexZone);
return 1;
}
function TimerLogin(playerid)
{
SendClientMessage(playerid,COLOR_GENERAL,"* Han pasado 30 segundos y no ingresaste correctamente, fuiste expulsado automбticamente.");
SetPlayerName(playerid,"InvalidNick");
Kick(playerid);
}

