15.05.2014, 18:18
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registrando...",""COL_RED"Has introducido una contrasela invalida.\n"COL_WHITE"Introduce una contraseсa debajo para registrar una nueva cuenta.","Registrar","Salir");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"Dinero", 5000);
INI_WriteInt(File,"Admin", 1);
INI_WriteInt(File,"Telefono", 0);
INI_WriteInt(File,"Coche1", 0);
INI_WriteInt(File,"Coche2", 0);
INI_WriteInt(File,"Coche3", 0);
INI_WriteInt(File,"Casa1", 0);
INI_WriteInt(File,"Casa2", 0);
INI_WriteInt(File,"Faccion", 0);
INI_WriteInt(File,"Job", 0);
INI_WriteInt(File,"Skin", 0);
INI_WriteInt(File,"Interior", 0);
INI_WriteFloat(File,"PosX", 0.0);
INI_WriteFloat(File,"PosY", 0.0);
INI_WriteFloat(File,"PosZ", 0.0);
INI_Close(File);
PlayerInfo[playerid][pDinero] = 5000;
GivePlayerMoney(playerid,5000);
SetSpawnInfo(playerid, PlayerInfo[playerid][pSkin], 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pPosZ], 269.15, 0, 0, 0, 0, 0, 0);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Bien!!",""COL_GREEN"Registrado correctamente! Reloguea para guardar tus datos!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(strcmp(inputtext, PlayerInfo[playerid][pPass]) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetSpawnInfo(playerid, PlayerInfo[playerid][pSkin], 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pPosZ], 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pDinero]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Contraseсa incorrecta.\n"COL_WHITE"Introduce tu contraseсa para entrar.","Login","Salir");
}
return 1;
}
}
case DIALOG_SUCCESS_1:
{
if(!response) return 0;
if(response) return SpawnPlayer(playerid);
}
}
return 1;
}