pawn Код:
public Registro(playerid,password[])
{
if(IsPlayerConnected(playerid))
{
new string[32];
new NombreJ[MAX_PLAYER_NAME];
GetPlayerName(playerid, NombreJ, sizeof(NombreJ));
format(string, sizeof(string), "Usuarios/%s.rpl", NombreJ);
new File: hFile = fopen(string, io_write);
if (hFile)
{
format(Info[playerid][Pass], 24, password);
new var[64];
format(var, 64, "Pass=%d\n", Info[playerid][Pass]);fwrite(hFile, var);
format(var, 64, "Level=%d\n", Info[playerid][Level]);fwrite(hFile, var);
format(var, 64, "Dinero=%d\n", Info[playerid][Dinero]);fwrite(hFile, var);
SetPlayerHealth(playerid,85.9); GetPlayerHealth(playerid,Info[playerid][Vida]);
format(var, 64, "Vida=%f\n", Info[playerid][Vida]);fwrite(hFile, var);
format(var, 64, "DineroSusto=%d\n", Info[playerid][DineroSusto]);fwrite(hFile, var);
format(var, 64, "Faccion=%d\n", Info[playerid][Faccion]);fwrite(hFile, var);
format(var, 64, "Job=%d\n", Info[playerid][Job]);fwrite(hFile, var);
format(var, 64, "Radio=%d\n", Info[playerid][Radio]);fwrite(hFile, var);
format(var, 64, "Frecuencia=%d\n", Info[playerid][Frecuencia]);fwrite(hFile, var);
format(var, 64, "RadioOn/Off=%d\n", Info[playerid][StatRadio]);fwrite(hFile, var);
format(var, 64, "Rango=%d\n", Info[playerid][Rango]);fwrite(hFile, var);
format(var, 64, "Hora=%d\n", Info[playerid][Horas]);fwrite(hFile, var);
format(var, 64, "Minutos=%d\n", Info[playerid][Mins]);fwrite(hFile, var);
format(var, 64, "Segundos=%d\n", Info[playerid][Segs]);fwrite(hFile, var);
format(var, 64, "PosX=%f\n", Info[playerid][Posx]);fwrite(hFile, var);
format(var, 64, "PosY=%f\n", Info[playerid][Posy]);fwrite(hFile, var);
format(var, 64, "PosZ=%d\n", Info[playerid][Posz]);fwrite(hFile, var);
format(var, 64, "Casa1=%d\n", Info[playerid][Casas][0]);fwrite(hFile, var);
format(var, 64, "Casa2=%d\n", Info[playerid][Casas][1]);fwrite(hFile, var);
format(var, 64, "Banco=%d\n", Info[playerid][MoneyBanco]); fwrite(hFile, var);
format(var, 64, "Registro=%d\n", Info[playerid][Reg]);fwrite(hFile, var);
//format(var, 64, "=%d\n", Info[playerid][]);fwrite(hFile, var);
//format(var, 64, "=%d\n", Info[playerid][]);fwrite(hFile, var);
//format(var, 64, "=%d\n", Info[playerid][]);fwrite(hFile, var);
//format(var, 64, "=%d\n", Info[playerid][]);fwrite(hFile, var);
fclose(hFile);
}
}
return 1;
}
public Login(playerid,password[])
{
//new tmp2[256];
new string2[64];
new fail[MAX_PLAYERS];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "Usuarios/%s.rpl", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Pass" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(Info[playerid][Pass], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(Info[playerid][Pass],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Level] = strval( val ); }
if( strcmp( key , "Dinero" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Dinero] = strval( val ); }
if( strcmp( key , "Vida" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Vida] = floatstr( val ); }
if( strcmp( key , "DineroSusto" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][DineroSusto] = strval( val ); }
if( strcmp( key , "Faccion" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Faccion] = strval( val ); }
if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Job] = strval( val ); }
if( strcmp( key , "Radio" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Radio] = strval( val ); }
if( strcmp( key , "Frecuencia" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Frecuencia] = strval( val ); }
if( strcmp( key , "RadioOn/Off" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][StatRadio] = strval( val ); }
if( strcmp( key , "Rango" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Rango] = strval( val ); }
if( strcmp( key , "Hora" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Horas] = strval( val ); }
if( strcmp( key , "Minutos" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Mins] = strval( val ); }
if( strcmp( key , "Segundos" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Segs] = strval( val ); }
if( strcmp( key , "PosX" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Posx] = floatstr( val ); }
if( strcmp( key , "PosY" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Posy] = floatstr( val ); }
if( strcmp( key , "PosZ" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Posz] = floatstr( val ); }
if( strcmp( key , "Staff" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Staff] = strval( val ); }
if( strcmp( key , "Casa1" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Casas][0] = strval( val ); }
if( strcmp( key , "Casa2" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Casas][1] = strval( val ); }
if( strcmp( key , "Banco" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][MoneyBanco] = strval( val ); }
if( strcmp( key , "Registro" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][Reg] = strval( val ); }
//if( strcmp( key , "" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][] = strval( val ); }
//if( strcmp( key , "" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][] = strval( val ); }
//if( strcmp( key , "" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][] = strval( val ); }
//if( strcmp( key , "" , true ) == 0 ) { val = ini_GetValue( Data ); Info[playerid][] = strval( val ); }
}
fclose(UserFile);
}
else
{
ShowPlayerDialog(playerid,D_Logeo,DIALOG_STYLE_PASSWORD,"Role Play Latino","Usted a ingresado una contraseсa incorrecta\nPorfavor introdusca la verdadera contraseсa\nsi te la olvidaste puedes entrar a nuestro foro y imformarte del tema","Logear","Canselar");
fail[playerid]++;
fclose(UserFile);
if(fail[playerid] >= 3)
{
Error(playerid,"Usted a superado los maximo intento de logerase en RPL");
Mensaje(playerid,Blanco,"Porfavor si usted se olvido de su contraseсa pidalo en nuestro foro "#WebPag" e imformese de como recuperarla");
fail[playerid] = 0;
Kick(playerid);
}
return 1;
}
if(Info[playerid][Reg] == 0)
{
SetSpawnInfo( playerid, 0, 295, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
Info[playerid][Dinero] = 1000;
Info[playerid][Vida] = 85.5;
Info[playerid][MoneyBanco] = 2000;
Info[playerid][Reg] = 1;
}
SpawnPlayer(playerid);
SetPlayerColor(playerid, PLAYERS_COLOR);
TimeFromTimePlayer(playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,Info[playerid][Dinero]);
SetPlayerHealth(playerid,Info[playerid][Vida]);
//SetPlayerPos(playerid,Info[playerid][Posx],Info[playerid][Posy],Info[playerid][Posz]); Terminar con el virtual world y interior
Mensaje(playerid,Amarillo,MensajeAdm);
}
return 1;
}