public OnPlayerSpawn(playerid) { if(PlayerInfo[playerid][pLastX] == 0.0 && PlayerInfo[playerid][pLastY] == 0.0) { SetPlayerPos(playerid, -185.5223, 977.4722, 19.0640); SetCameraBehindPlayer(playerid); SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]); SetPlayerHealth(playerid, PlayerInfo[playerid][Health]); SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]); } else { SetPlayerPos(playerid, PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ]); SetPlayerFacingAngle(playerid, PlayerInfo[playerid][pLastA]); SetPlayerInterior(playerid, PlayerInfo[playerid][Interior]); SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][VirtualWorld]); SetCameraBehindPlayer(playerid); SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]); SetPlayerHealth(playerid, PlayerInfo[playerid][Health]); SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]); } TextDrawHideForPlayer(playerid, TDEditor_TD[0]); IsAfterLifing[playerid] = 0; if (IsDead[playerid] == 1) { SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5); SetPlayerCameraLookAt(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]); TogglePlayerControllable(playerid,false); ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0); DyingTimer[playerid] = SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid); SendClientMessage(playerid,WHITE,"Use /ems to call medics"); SendClientMessage(playerid,WHITE,"You can type /acceptdeath, if no medics are available."); return 1; } return 1; } Dialog Register code: case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",10000); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_WriteInt(File,"Gender",0); INI_WriteInt(File,"Age",0); INI_WriteInt(File,"Skin",0); INI_WriteInt(File,"Faction",0); INI_WriteInt(File,"fRank",0); INI_WriteInt(File,"fDiv",0); INI_WriteInt(File,"fLeader",0); INI_Close(File); PlayerInfo[playerid][pLogged] = 1; PlayerInfo[playerid][pMinutes] = 0; SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); GivePlayerMoney(playerid, 10000); ShowPlayerDialog(playerid, 51, DIALOG_STYLE_INPUT, "Enter Your Age.", "What is your age? e.g 18", "Enter", "Cancel"); } } if(dialogid == 51) { if( !response ) return Kick( playerid ); if(response) { if(strlen(inputtext)) { new age = strval(inputtext); if(inputtext[0] > 80 || inputtext[0] < 16) { ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age","How old is your character?\nYour character's age must be between 16 and 80.","Proceed","Quit"); } else //If the player types a age that meets the requirements { PlayerInfo[playerid][Age] = age; //Sets the player's age new string[ 64 ] ; format(string, sizeof(string), "You are %d years old.",strval(inputtext)); SendClientMessage(playerid, green, string); SetTimer("SpectateFix", 350, false); //Fixes a bug that needs this timer in order to successfully use mSelection ShowPlayerDialog(playerid, 52, DIALOG_STYLE_LIST, "Select Your Gender", "Male \nFemale", "Select", "Cancel"); } } } } if(dialogid == 52) { if(!response) { Kick(playerid); } else { if(listitem == 0) { PlayerInfo[playerid][Gender] = 1; SendClientMessage(playerid, green, "You are Male."); ShowPlayerDialog(playerid, 53, DIALOG_STYLE_INPUT, "Select Your skin", "Enter the Skin ID - They are limited for now.", "Select", "Cancel"); } if(listitem == 1) { PlayerInfo[playerid][Gender] = 2; SendClientMessage(playerid, green, "You are Female."); ShowPlayerDialog(playerid, 53, DIALOG_STYLE_INPUT, "Select Your skin", "Enter the Skin ID - They are limited for now.", "Select", "Cancel"); } } } if(dialogid == 53) { if(!response) return Kick(playerid); if(response) { if(strlen(inputtext)) { new skin = strval(inputtext); if(IsInvalidSkin(skin)) { ShowPlayerDialog(playerid, 53, DIALOG_STYLE_INPUT, "Select Your skin", "This is an invalid skin ID for this server \n Enter a valid Skin ID", "Select", "Cancel"); } else { PlayerInfo[playerid][Skin] = strval(inputtext); new str[128]; format(str, 128, "You choosed your skin ID %d", strval(inputtext)); SendClientMessage(playerid, green, str); } } } }
For debuging in playerspawn print PlayerInfo[playerid][Health]. Maybe its 0.
|