When I die, I get moved away like 20-30 meters away.
#1

Part of the code:

Код:
if (PlayerData[i][pInjured] == 1 && GetPlayerAnimationIndex(i) != 388)
		{
			ApplyAnimation(i, "CRACK", "crckdeth4", 4.1, 0, 0, 0, 1, 0, 1);
		}
Reply
#2

Quote:
Originally Posted by BluePlayBG
Посмотреть сообщение
Part of the code:

Код:
if (PlayerData[i][pInjured] == 1 && GetPlayerAnimationIndex(i) != 388)
		{
			ApplyAnimation(i, "CRACK", "crckdeth4", 4.1, 0, 0, 0, 1, 0, 1);
		}
Explain more, what do you mean when you die you get moved 20 meters? do you move those WHILE you're dying OR the moment you spawn?? provide the OnPlayerDeath code too, when is a player counted as an "injured player" ? is removing that "ApplyAnimation" fixes the problem?
Reply
#3

OnPlayerDeath

Код:
 public OnPlayerDeath(playerid, killerid, reason)
{
	if (killerid != INVALID_PLAYER_ID)
	{
	    if (1 <= reason <= 46)
			Log_Write("logs/kill_log.txt", "[%s] %s has killed %s (%s).", ReturnDate(), ReturnName(killerid), ReturnName(playerid), ReturnWeaponName(reason));

		else
			Log_Write("logs/kill_log.txt", "[%s] %s has killed %s (reason %d).", ReturnDate(), ReturnName(killerid), ReturnName(playerid), reason);

		if (reason == 50 && killerid != INVALID_PLAYER_ID)
		    SendAdminAlert(COLOR_LIGHTRED, "[ADMIN]: %s has killed %s by heli-blading.", ReturnName(killerid, 0), ReturnName(playerid, 0));

        if (reason == 29 && killerid != INVALID_PLAYER_ID && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
		    SendAdminAlert(COLOR_LIGHTRED, "[ADMIN]: %s has killed %s by driver shooting.", ReturnName(killerid, 0), ReturnName(playerid, 0));
	}
	if(IsInBus[playerid] == 1)
	{
		IsInBus[playerid] = 0;
  		KillTimer(Timer1[playerid]);
		KillTimer(Timer2[playerid]);
	}
	if(IsInShml[playerid] == 1)
	{
	    IsInShml[playerid] = 0;
	}
	if(Intropic[playerid] == 1)
	{
	    Intropic[playerid] = 0;
	}
	if(InAmbulance[playerid] == 1)
	{
	    InAmbulance[playerid] = 0;
	}
	if(InEnforcer[playerid] == 1)
	{
	    InEnforcer[playerid] = 0;
	}
	if(InJourney[playerid] == 1)
	{
	    InJourney[playerid] = 0;
	}
	if(InRaindance[playerid] == 1)
	{
	    InRaindance[playerid] = 0;
	}
	waittimer();
	return 1;
}
Reply
#4

After someone kill me, I get moved 20 meters away from the position I've been killed,
Reply
#5

Quote:
Originally Posted by BluePlayBG
Посмотреть сообщение
After someone kill me, I get moved 20 meters away from the position I've been killed,
you still didn't answer, when do you get moved those 20 meters! the moment you die or the moment you spawn? also show the code for waittmer
Reply
#6

I have a death system, so when I die, I get teleported and when I /giveup I get tped to the hospital. So the answer is when I die.
Reply
#7

Quote:
Originally Posted by BluePlayBG
Посмотреть сообщение
I have a death system, so when I die, I get teleported and when I /giveup I get tped to the hospital. So the answer is when I die.
I give up, show your waittimer and OnPlayerSpawn functions your death function is clean.
Reply
#8

Код:
 forward waittimer();
public waittimer()
{
	robpossible = 1;
} [
This is the part of the death function (waittimer)
Код:
 	waittimer();
	return 1;
}
OnPlayerSpawn:

Код:
 public OnPlayerSpawn(playerid)
{
    // Skill levels
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 0);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 0);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 0);
	
	/*if (PlayerData[playerid][pSpawnPoint])
	{
	 	SetDefaultSpawn(playerid);
	}*/
	
	if (PlayerData[playerid][pHUD])
	{
	 	TextDrawShowForPlayer(playerid, gServerTextdraws[0]);
		TextDrawShowForPlayer(playerid, gServerTextdraws[1]);
	}
    SetPlayerSkin(playerid, PlayerData[playerid][pSkin]);
    Streamer_ToggleIdleUpdate(playerid, true);
    //SetSpawnInfo(playerid, 0, PlayerData[playerid][pSkin], PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2], PlayerData[playerid][pPos][3], 0, 0, 0, 0, 0, 0);

	PlayerData[playerid][pKilled] = 0;

    if (PlayerData[playerid][pBleeding])
	{
 		PlayerData[playerid][pBleedTime] = 1;
   	}
	if (PlayerData[playerid][pJailTime] > 0)
	{
	    if (PlayerData[playerid][pPrisoned])
	    {
	        SetPlayerInPrison(playerid);
	    }
	    else
	    {
		    SetPlayerPos(playerid, 197.6346, 175.3765, 1003.0234);
		    SetPlayerInterior(playerid, 3);

		    SetPlayerVirtualWorld(playerid, (playerid + 100));
		    SetPlayerFacingAngle(playerid, 0.0);

		    SetCameraBehindPlayer(playerid);
		}
		ResetWeapons(playerid);

		PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][70]);
	    SendServerMessage(playerid, "You have %d seconds of remaining jail time.", PlayerData[playerid][pJailTime]);
	}
	else if (PlayerData[playerid][pHospital] != -1)
	{
	    PlayerData[playerid][pHospitalTime] = 0;

	    PlayerData[playerid][pHunger] = 50;
	    PlayerData[playerid][pThirst] = 50;

		SetPlayerInterior(playerid, 3);
		SetPlayerVirtualWorld(playerid, playerid + 100);

		SetPlayerPos(playerid, -211.0370, -1738.6848, 676.7153);
		SetPlayerFacingAngle(playerid, 82.0000);

		SetPlayerCameraPos(playerid, -214.236602, -1738.812133, 676.648132);
		SetPlayerCameraLookAt(playerid, -203.072738, -1738.656127, 675.768737);

        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);

		GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~Recovering... 15", 1000, 3);
		TogglePlayerControllable(playerid, 0);
	}
	else if (!PlayerData[playerid][pCreated])
	{
    	TogglePlayerControllable(playerid, 0);
		SetPlayerPos(playerid, 216.8005, -99.8691, 1005.2578);
    	SetPlayerFacingAngle(playerid, 90.0000);

  		SetPlayerInterior(playerid, 15);
		SelectTextDraw(playerid, -1);

		for (new i = 23; i < 34; i ++) {
		    PlayerTextDrawShow(playerid, PlayerData[playerid][pTextdraws][i]);
		}
	}
	else
	{
	    SetPlayerFacingAngle(playerid, PlayerData[playerid][pPos][3]);

	    SetPlayerInterior(playerid, PlayerData[playerid][pInterior]);
	    SetPlayerVirtualWorld(playerid, PlayerData[playerid][pWorld]);

		SetCameraBehindPlayer(playerid);
		SetAccessories(playerid);

        if (PlayerData[playerid][pWorld] == PRISON_WORLD)
		{
		    SetPlayerPosEx(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
		}
		else
		{
		    if(PlayerData[playerid][pInjured] == 0)
			{
				SetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]);
			}
		}
		if (PlayerData[playerid][pInjured])
		{
		    ShowHungerTextdraw(playerid, 0);

			TextDrawShowForPlayer(playerid, gServerTextdraws[2]);
			SendClientMessage(playerid, COLOR_LIGHTRED, "[WARNING]:{FFFFFF} You are injured and require medical attention (/call 911).");

			ApplyAnimation(playerid, "CRACK", "null", 4.0, 1, 1, 0, 1, 0, 1);
			ApplyAnimation(playerid, "CRACK", "crckdeth4", 4.0, 0, 1, 1, 1, 0, 1);
		}
		else
		{
			SetWeapons(playerid);
			ShowHungerTextdraw(playerid, 1);

			SetPlayerHealth(playerid, PlayerData[playerid][pHealth]);
			SetPlayerArmour(playerid, PlayerData[playerid][pArmorStatus]);
		}
	}
	return 1;
}
Reply
#9

Look:
https://www.youtube.com/watch?v=8VBk...ature=*********
Reply
#10

Quote:
Originally Posted by BluePlayBG
Посмотреть сообщение
"video not available"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)