I spawn dead and in CJ skin after second login -
AndySedeyn - 01.05.2014
After registering an account, I spawn at the correct spot with all the information correctly prompted.
Whenever I relog or restart the server, I spawn at blueberry in CJ skin and 0 HP (Dead).
My server log says: "Bible died 255".
LOGIN_DIALOG
pawn Код:
if(dialogid == DIALOG_LOGIN)
{
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
gPlayerLogged[playerid] = 1;
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
format(tmp2, sizeof(tmp2), "~g~Welcome ~n~~w~ %s", GetName(playerid));
GameTextForPlayer(playerid, tmp2, 5000, 1);
TogglePlayerSpectating(playerid, 0);
TogglePlayerControllable(playerid, 1);
SetPlayerColor(playerid, TRANSPARENT_WHITE);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(tmp2, sizeof(tmp2), "[SERVER] You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,tmp2);
}
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","{FFFFFF}Welcome back to {00FF26}SERVER NAME!{FFFFFF}\n\nThat name is registered. Please enter your password below.\n\n{FF0000} You have entered an incorrect password!","Login","Quit"); //login
}
}
if(!response)
{
format(qstring, sizeof(qstring), "[AdmCMD] You have chosen to 'Quit', you're always welcome to come back!");
SCM(playerid, COLOR_LIGHTRED, qstring);
SetTimerEx("kickbugfix", 1000, false, "i", playerid);
}
}
If you need more information regarding my script or the problem, let me know.
Help is much appreciated.
Sincerely,
Bible
Re: I spawn dead and in CJ skin after second login -
superrobot48 - 01.05.2014
pawn Код:
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
might be the problem.
your last health must be 0

DO THIS
pawn Код:
if(PlayerInfo[playerid][pHealth] == 0) // if player health from file = 0
{
PlayerInfo[playerid][pHealth] = 100; // Setting health 100
}
add this before
pawn Код:
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
Re: I spawn dead and in CJ skin after second login -
AndySedeyn - 01.05.2014
Yeah that works,
But I want it that if a player relogs with let's say 80 HP, his HP stays 80 unless he heals.
Re: I spawn dead and in CJ skin after second login -
AndySedeyn - 01.05.2014
Fixed.
-This can be locked or deleted-