01.10.2015, 01:04
Olб Galera
!
Meu Problema Й O Salvamento Da Skin Do Player ._.
Ele Nгo Salva A Skin Do Player!
Alguйm Ajuda Ae, Sou Novato Em Sistemas De Salvamento HEHE!
__________________________________________________ _______________________________________________
Obrigado Desde Jб
!
!Meu Problema Й O Salvamento Da Skin Do Player ._.
Ele Nгo Salva A Skin Do Player!
Alguйm Ajuda Ae, Sou Novato Em Sistemas De Salvamento HEHE!
PHP код:
#define Contas "Contas/%s.ini"
#define Login "Bem-Vindo Ao Brasil Rockstar GameS!\nDigite Sua Senha Para Logar-Se!."
#define Registro "Bem-Vindo Ao Brasil Rockstar GameS!\nDigite Uma Senha Abaixo Para Se Registre-Se!."
PHP код:
enum pInfo
{
pGrana,
pSenha,
pSkin,
pLevel,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
PHP код:
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid,nome,24);
format(arquivo,50,Contas,nome);
if(fexist(arquivo))
{
GetPlayerName(playerid,nome,24);
format(BRG,90,Login,nome);
ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",BRG,"entrar","sair");
}
else
{
GetPlayerName(playerid,nome,24);
format(BRG,90,Registro,nome);
ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",BRG,"registrar","sair");
}
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
SalvarContas( playerid );
return 1;
}
PHP код:
public OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 9999)
{
if(!response) return Kick(playerid);
if(response)
{
GetPlayerName(playerid,nome,24);
format(arquivo,50,Contas,nome);
DOF2_CreateFile(arquivo);
DOF2_SetString(arquivo,"Senha",inputtext);
PlayerInfo[playerid][pSenha] = strlen(inputtext);
PlayerInfo[playerid][pLevel] = DOF2_SetInt(arquivo,"Level",5);
PlayerInfo[playerid][pGrana] = DOF2_SetInt(arquivo,"Dinheiro",50000);
PlayerInfo[playerid][pSkin] = DOF2_SetInt(arquivo, "Skin",59);
format(BRG,90,Login,nome);
new len = strlen(inputtext);
if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",Login,"ok","fechar");
}
}
if(dialogid == 9998)
{
if(!response) return Kick(playerid);
if(response)
{
new senha[20];
GetPlayerName(playerid,nome,24);
format(arquivo,50,Contas,nome);
format(senha,20,"%s",strval(inputtext));
if(strcmp(inputtext,DOF2_GetString(arquivo,"Senha"),true) == 0)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
return SendClientMessage(playerid,-1,"senha errada.");
}
GetPlayerName(playerid,nome,24);
format(arquivo,28,Contas,nome);
SetPlayerScore(playerid,DOF2_GetInt(arquivo,"Level"));
GivePlayerMoney(playerid,DOF2_GetInt(arquivo,"Dinheiro"));
PlayerInfo[playerid][pSkin] = DOF2_GetInt(arquivo, "Skin");
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SendClientMessage(playerid, -1, "[BRG] Logado Com Sucesso!");
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], -2025.4244,145.6596,28.8359, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer( playerid );
}
else
{
ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
SendClientMessage(playerid,-1,"senha errada.");
}
}
}
return 1;
}
PHP код:
stock SalvarContas(playerid)
{
PlayerInfo[playerid][pGrana] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
DOF2_SetInt(Contas,"Skin", PlayerInfo[playerid][pSkin]);
DOF2_SetInt(Contas, "Senha",PlayerInfo[playerid][pSenha]);
DOF2_SetInt(Contas, "Level",PlayerInfo[playerid][pLevel]);
DOF2_SetInt(Contas, "Dinheiro",PlayerInfo[playerid][pGrana]);
DOF2_SaveFile();
return 1;
}
Obrigado Desde Jб
!

