Player dies when registration is complete,
#1

I am using Y_INI system and registration system was working fine at first but now I've made more commands and systems and I am facing a problem with registration, when player register he starts dying and you need to relog after that to stop player from dying, player dies again & again. Any suggestions what to do here ?
Reply
#2

You probably have a corrupted file, like a filterscript or include,
That kinda happened to me once, I just removed the filter script.
If that doesn't work, do you mind showing me your code?
Reply
#3

Код:
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);
                }
            }
        }
    }
Includes are these

#include <a_samp>
#include <foreach>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf>
#include <streamer>
Reply
#4

For debuging in playerspawn print PlayerInfo[playerid][Health]. Maybe its 0.
Reply
#5

And I am not using any FS, I am just using Streamer plugin
Reply
#6

Quote:
Originally Posted by Lbaker
Посмотреть сообщение
For debuging in playerspawn print PlayerInfo[playerid][Health]. Maybe its 0.
No, It's Set to the last health you had when you disconnect.
Reply
#7

Check it anyway. in the code only this will be reason of player die.
Reply
#8

Now player didn't died, but Some other thing happened, While in the registration process server closed the connection.

http://imgur.com/a/6OORA
Reply
#9

All I can do is now that I should complete the registration process from City Hall. It will be more roleplay, because nothing is working.
Reply
#10

Any suggestions about it how to solve this ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)