04.01.2013, 23:43
Hi guys,
i use dini for register and login, but if i login to server, my character is dead and respawn in medical (loc. in OnPlayerDeath).
Data is correctly saved to file, i check it...
OnDialogResponse - login dialog, if response is 1:
new pw[200];
format(pw, sizeof(pw), "%s", dini_Get(DiniPath(playerid), "Password"));
if(strcmp(inputtext, pw) == 0)
{
LoadPlayer(playerid);
}
LoadPlayer()
public LoadPlayer(pid)
{
Player[pid][Login] = true;
Player[pid][Experience] = dini_Int(DiniPath(pid), "Experience");
Player[pid][AdminLevel] = dini_Int(DiniPath(pid), "AdminLevel");
Player[pid][WantedLevel] = dini_Int(DiniPath(pid), "WantedLevel");
Player[pid][Job] = dini_Int(DiniPath(pid), "Job");
Player[pid][Money] = dini_Int(DiniPath(pid), "Money");
Player[pid][Bank] = dini_Int(DiniPath(pid), "Bank");
Player[pid][pSkin] = dini_Int(DiniPath(pid), "Skin");
Player[pid][Mute] = dini_Int(DiniPath(pid), "Mute");
Player[pid][Freeze] = dini_Int(DiniPath(pid), "Freeze");
Player[pid][Warns] = dini_Int(DiniPath(pid), "Warns");
Player[pid][HideList] = dini_Int(DiniPath(pid), "HideList");
Player[pid][HideHead] = dini_Int(DiniPath(pid), "HideHead");
Player[pid][HideChat] = dini_Int(DiniPath(pid), "HideChat");
Player[pid][ManagePlayer] = false;
Player[pid][Spectating] = false;
Player[pid][pHP] = dini_Float(DiniPath(pid), "pHP");
Player[pid][pArmor] = dini_Float(DiniPath(pid), "pArmor");
Player[pid][pX] = dini_Float(DiniPath(pid), "X");
Player[pid][pY] = dini_Float(DiniPath(pid), "Y");
Player[pid][pZ] = dini_Float(DiniPath(pid), "Z");
RefreshColorAnd3D(pid);
SetTimerEx("AfterLoginSaveAccount", 7500, false, "i", pid);
return 1;
}
public OnPlayerRequestSpawn(playerid){
if(Player[playerid][Login]){
return 1;
}
return 0;
}
public OnPlayerRequestClass(playerid){
if(Player[playerid][Login]){
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ], 135.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, Player[playerid][pHP]);
SetPlayerArmour(playerid, Player[playerid][pArmor]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerScore(playerid, 0);
SetCameraBehindPlayer(playerid);
return 1;
}else{
return 0;
}
}
Thanks for your support
i use dini for register and login, but if i login to server, my character is dead and respawn in medical (loc. in OnPlayerDeath).
Data is correctly saved to file, i check it...
OnDialogResponse - login dialog, if response is 1:
new pw[200];
format(pw, sizeof(pw), "%s", dini_Get(DiniPath(playerid), "Password"));
if(strcmp(inputtext, pw) == 0)
{
LoadPlayer(playerid);
}
LoadPlayer()
public LoadPlayer(pid)
{
Player[pid][Login] = true;
Player[pid][Experience] = dini_Int(DiniPath(pid), "Experience");
Player[pid][AdminLevel] = dini_Int(DiniPath(pid), "AdminLevel");
Player[pid][WantedLevel] = dini_Int(DiniPath(pid), "WantedLevel");
Player[pid][Job] = dini_Int(DiniPath(pid), "Job");
Player[pid][Money] = dini_Int(DiniPath(pid), "Money");
Player[pid][Bank] = dini_Int(DiniPath(pid), "Bank");
Player[pid][pSkin] = dini_Int(DiniPath(pid), "Skin");
Player[pid][Mute] = dini_Int(DiniPath(pid), "Mute");
Player[pid][Freeze] = dini_Int(DiniPath(pid), "Freeze");
Player[pid][Warns] = dini_Int(DiniPath(pid), "Warns");
Player[pid][HideList] = dini_Int(DiniPath(pid), "HideList");
Player[pid][HideHead] = dini_Int(DiniPath(pid), "HideHead");
Player[pid][HideChat] = dini_Int(DiniPath(pid), "HideChat");
Player[pid][ManagePlayer] = false;
Player[pid][Spectating] = false;
Player[pid][pHP] = dini_Float(DiniPath(pid), "pHP");
Player[pid][pArmor] = dini_Float(DiniPath(pid), "pArmor");
Player[pid][pX] = dini_Float(DiniPath(pid), "X");
Player[pid][pY] = dini_Float(DiniPath(pid), "Y");
Player[pid][pZ] = dini_Float(DiniPath(pid), "Z");
RefreshColorAnd3D(pid);
SetTimerEx("AfterLoginSaveAccount", 7500, false, "i", pid);
return 1;
}
public OnPlayerRequestSpawn(playerid){
if(Player[playerid][Login]){
return 1;
}
return 0;
}
public OnPlayerRequestClass(playerid){
if(Player[playerid][Login]){
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ], 135.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, Player[playerid][pHP]);
SetPlayerArmour(playerid, Player[playerid][pArmor]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerScore(playerid, 0);
SetCameraBehindPlayer(playerid);
return 1;
}else{
return 0;
}
}
Thanks for your support