problem in load inf DOF2
#1

Hello, the DOF2 that esotu using in GM, not wanting to load like the information of the players, example: money, score, skin, color among others, can someone help me?

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) // We switch the dialogs
{
case DIALOG_REGISTER: // If dialog_register (id 1) shows up
{
if(!response) Kick(playerid);// If he click on Quit, he will get kicked
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Brasil Play Hard","{FFFFFF}Por favor, insira uma senha para efetuar seu registro!","Registrar","Sair");
// If he doesn't type anything, the dialog will show again.
if(response) // If he click on Register
{
new file[64]; // We declare the size of the file
GetPlayerName(playerid,file,sizeof(file)); // We get the file name
format(file,sizeof(file),DOF2_File(file)); // We get the path name from DOF2_File, that means from Users folder.
DOF2_CreateFile(file, inputtext); // Creates the file and the password.
DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]); // When the player register his kills will be set to 0, you can change
DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]); // His deaths will be set to 0, you can change
DOF2_SetInt(file, "Money",PlayerInfo[playerid][pMoney] = 450); // His money will be set to 1000, you can change
DOF2_SetInt(file, "Cash",PlayerInfo[playerid][pCash]);
DOF2_SetInt(file, "Cor",PlayerInfo[playerid][pCor] = 0xFFFFFF);
DOF2_SetInt(file, "Score",PlayerInfo[playerid][pScore]);
DOF2_SetInt(file, "Skin",PlayerInfo[playerid][pSkin]);
DOF2_SaveFile(); // Saves the file.
SetSpawnInfo(playerid, 0, 0, 826.1004,-1359.6998,-0.5078,319.3713,0,0,0,0,0,0); // Sets where the player will spawn, this coordinates are from the Unity Station in Los Santos
SpawnPlayer(playerid); // After registering, the player will spawn.

new nome [ MAX_PLAYER_NAME ], string[128] ;
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string),"Olб %s. Sejб bem vindo pela primeira vez ao [BPH]",nome);
SendClientMessage(playerid, -1, string);
ShowPlayerDialog(playerid, SEXO, DIALOG_STYLE_LIST, "Escolha seu sexo","{0101DF}Masculino\n{FE2EF7}Feminino","Escol her","");

}
}
case DIALOG_LOGIN: // If dialog_login (id 2) shows up
{
if(!response) Kick(playerid); // If he click on Quit, he will get kicked.
if(response) // If he click on Log-in
{
new file[64]; // We declare the size of the file
GetPlayerName(playerid,file,sizeof(file)); // We get the file name
format(file,sizeof(file),DOF2_File(file)); // We get the user path from DOF2_File ( folder Users )
if(DOF2_FileExists(file)) // If he is registered
{
if(DOF2_CheckLogin(file,inputtext)) // We check if the password match
{
SetSpawnInfo(playerid, 0, 0, 1722.5123, -1912.7931, 13.5647, 269.15, 0, 0, 0, 0, 0, 0); // We set the spawn (Unity Station)
SpawnPlayer(playerid); // The player spawns after log-in
return 1;
}
else // If the password don't match, they will get an error
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Brasil Play Hard","{F81414}Senha inserida estб incorreta\n{FFFFFF}Insira sua senha para efetuar o login!","Logar","Sair");
return 1;
}
}
}
}
}

when the player disconnects
Quote:

public OnPlayerDisconnect(playerid, reason)
{
new file[64];
GetPlayerName(playerid, file, sizeof(file));
format (file, sizeof(file), DOF2_File(file));
PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCor] = GetPlayerColor(playerid);
DOF2_SetInt(file, "Money", PlayerInfo[playerid][pMoney]);
DOF2_SetInt(file, "Cor", PlayerInfo[playerid][pCor]);
DOF2_SetInt(file, "Skin", PlayerInfo[playerid][pSkin]);
DOF2_SetInt(file, "Score", PlayerInfo[playerid][pSkin]);
DOF2_SaveFile();

return 1;
}

when the player spawn
Quote:

public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,TDEditor_TD[6]);
TextDrawShowForPlayer(playerid,TDEditor_TD[7]);
TextDrawShowForPlayer(playerid,TDEditor_TD[8]);
TextDrawShowForPlayer(playerid,TDEditor_TD[9]);

TextDrawHideForPlayer(playerid,TDEditor_TD[0]);
TextDrawHideForPlayer(playerid,TDEditor_TD[1]);
TextDrawHideForPlayer(playerid,TDEditor_TD[2]);
TextDrawHideForPlayer(playerid,TDEditor_TD[3]);
TextDrawHideForPlayer(playerid,TDEditor_TD[4]);
TextDrawHideForPlayer(playerid,TDEditor_TD[5]);
new file[64];
ResetPlayerMoney(playerid);

PlayerInfo[playerid][pMoney] = DOF2_GetInt(file, "Money");
GivePlayerMoney( playerid, PlayerInfo[playerid] [pMoney] );
CancelSelectTextDraw(playerid);

return 1;
}

Reply
#2

I see you are checking password match(DOF2_CheckLogin) but where do you load if the player password is correct? You have to store those values from file into your PlayerInfo array.
Reply
#3


is already storing the password and his information in PlayerInfo, but when the player logs in the server, the money is not set in his account, type, it deslogo of the server with $ 320 and when he log in he should win $ 320 but he does not win


https://pastebin.com/gDKy2hRQ
Reply
#4

Look all you do is this:
PHP код:
SetSpawnInfo(playerid001722.5123, -1912.793113.5647269.15000000); // We set the spawn (Unity Station)
SpawnPlayer(playerid); // The player spawns after log-in 
When the player logs in. You are not storing data from file anywhere into your array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)