stock CriarDados(playerid)
{
if(DOF2_CreateFile(ContaPlayer(playerid)))
{
new Data[24], Dia, Mes, Ano, Hora, Minuto;
gettime(Hora, Minuto);
getdate(Ano, Mes, Dia);
format(Data, 24, "%02d/%02d/%d - %02d:%02d", Dia, Mes, Ano, Hora, Minuto);
//DOF2_SetString(ContaPlayer(playerid),"Senha");
DOF2_SetString(ContaPlayer(playerid), "Senha", PlayerInfo[playerid][Senha]);
//DOF2_SetString(ContaPlayer(playerid), "Cуdigo", PlayerInfo[playerid][Codigo]);
//DOF2_SetInt(ContaPlayer(playerid),"Sexo", PlayerInfo[playerid][Sexo]);
DOF2_SetString(ContaPlayer(playerid), "Registro da conta", Data);
DOF2_SetInt(ContaPlayer(playerid),"Level", PlayerInfo[playerid][Level]);
DOF2_SetInt(ContaPlayer(playerid),"Skin",PlayerInfo[playerid][Skin]);
DOF2_SetInt(ContaPlayer(playerid),"pAdmin", PlayerInfo[playerid][pAdmin]);
DOF2_SetFloat(ContaPlayer(playerid), "PosX", pPosX[playerid]); // Escreve dentro do Arquivo: "PosX = pPosX (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosY", pPosY[playerid]); // Escreve dentro do Arquivo: "PosY = pPosY (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosZ", pPosZ[playerid]); // Escreve dentro do Arquivo: "PosZ = pPosZ (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosA", pPosA[playerid]); // Escreve dentro do Arquivo: "PosA = pPosA (posiзгo que pegamos antes, lembra ?)
DOF2_SetInt(ContaPlayer(playerid), "Interior", pInterior[playerid]); // Escreve dentro do Arquivo: "Interior = pInterior (interior que pegamos antes, lembra ?)
DOF2_SetInt(ContaPlayer(playerid), "Plano", 5);
DOF2_SetInt(ContaPlayer(playerid), "FOME", 100);
DOF2_SetInt(ContaPlayer(playerid), "SEDE", 100);
DOF2_SetInt(ContaPlayer(playerid), "SONO", 100);
// DOF2_SetInt(ContaPlayer(playerid),"Plano", PlayerInfo[playerid][Plano]);
DOF2_SetInt(ContaPlayer(playerid), "Profissгo", 0);
SetSpawnInfo(playerid, 0, 156, 388.0107,-1525.8547,32.2734,237.9921, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_PERGUNTA_SEGURANCA, DIALOG_STYLE_INPUT,"{00FFFF}City Of paradise - Cуdigo","{FF3C41}Insira um cуdigo de seguranзa, ele servira para proteger mais sua conta, caso vocк perca o cуdigo de seguranзa vocк perdera acesso a muitas coisas da sua conta !","Pronto","");
DOF2_SaveFile();
}
return 1;
}
stock SalvarPlayer(playerid)
{
if(DOF2_FileExists(ContaPlayer(playerid)))
{
new Data[24], Dia, Mes, Ano, Hora, Minuto;
gettime(Hora, Minuto);
getdate(Ano, Mes, Dia);
format(Data, 24, "%02d/%02d/%d - %02d:%02d", Dia, Mes, Ano, Hora, Minuto);
//
DOF2_SetInt(ContaPlayer(playerid),"Sexo", PlayerInfo[playerid][Sexo]);
DOF2_SetString(ContaPlayer(playerid), "pLastLogin", Data);
DOF2_SetInt(ContaPlayer(playerid),"Level", GetPlayerScore(playerid));
DOF2_SetInt(ContaPlayer(playerid),"Skin",GetPlayerSkin(playerid));
DOF2_SetInt(ContaPlayer(playerid),"pAdmin", PlayerInfo[playerid][pAdmin]);
DOF2_SetInt(ContaPlayer(playerid),"Profissгo",PlayerInfo[playerid][pProf]);
DOF2_SetInt(ContaPlayer(playerid),"Plano",PlayerInfo[playerid][Plano]);
// ---------------------------------------------------------------------------- //
DOF2_SetFloat(ContaPlayer(playerid), "PosX", pPosX[playerid]); // Escreve dentro do Arquivo: "PosX = pPosX (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosY", pPosY[playerid]); // Escreve dentro do Arquivo: "PosY = pPosY (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosZ", pPosZ[playerid]); // Escreve dentro do Arquivo: "PosZ = pPosZ (posiзгo que pegamos antes, lembra ?)
DOF2_SetFloat(ContaPlayer(playerid), "PosA", pPosA[playerid]); // Escreve dentro do Arquivo: "PosA = pPosA (posiзгo que pegamos antes, lembra ?)
DOF2_SetInt(ContaPlayer(playerid), "Interior", pInterior[playerid]); // Escreve dentro do Arquivo: "Interior = pInterior (interior que pegamos antes, lembra ?)
DOF2_SaveFile();
}
return 1;
}
//Quando o jogador se registrar
PlayerInfo[playerid][Plano] = 5;
DOF2_SetInt(ContaPlayer(playerid), "Plano", PlayerInfo[playerid][Plano]);
//OnPlayerConnect
PlayerInfo[playerid][Plano] = 0;
//OnPlayerDisconnect
PlayerInfo[playerid][Plano] = 0;
//Carregamento
PlayerInfo[playerid][Plano] = DOF2_GetInt(ContaPlayer(playerid), "Plano");
//Salvamento
DOF2_SetInt(ContaPlayer(playerid), "Plano", PlayerInfo[playerid][Plano]);
PlayerInfo[playerid][Plano] = 10; DOF2_SetInt(ContaPlayer(playerid), "Plano", PlayerInfo[playerid][Plano]); DOF2_SaveFile(); |
PlayerInfo[playerid][Plano] += 10;
Muito obrigado, funcionou certinho, sу uma duvida, quando o player fazer uma compra, eu nгo quero chamar o salvamento da conta inteira dele, quero salvar sу o que ele comprou, assim caso ele faзa um grande investimento e servidor caia n de b.o pra ele ... entгo eu posso fazer tipo isso?
Supor que ele comprou 10 planos Certo? |
SalvarPlayer(playerid);
DOF2_SetInt(ContaPlayer(playerid), "Plano", PlayerInfo[playerid][Plano]);
DOF2_SaveFile();