SA-MP Forums Archive
Timer after the player dies - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer after the player dies (/showthread.php?tid=665284)



Timer after the player dies - chiornyybumer - 29.03.2019

Right guys, I have a gamemode, and when the player gets killed he just spawns straight away to hospital... So I made a timer for 3sec, so it will show the death animation and stuff, and then spawn him, it does kinda work in a hospital ( Most of the times he spawns with a cigar or bottle in his hands, and runs like he has a cj skin ) But then I tried to do the same with my new DM zone system, and it just shows me the requestplayspawn window, and then falls from the sky into the center of the world in the desert..

My code:
Next to all the new'ssss
HTML Code:
new bool:IsDead;
Then onplayerdeath I'm making a timer for 3sec
HTML Code:
SetTimerEx("Dead", 3000, false, "dd", playerid,0);
When the timer is done, I'm setting the spawn info
I tried method 1:
HTML Code:
forward Dead(playerid);
public Dead(playerid)
{
        if(PlayerDB[playerid][IsInDM] == true)
       {
                SetSpawnInfo(playerid, NO_TEAM, PlayerDB[playerid][DeathSkin], -2653.3843,637.0585,244.3842, 1.7319, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                return 1;
        }
        PlayerDB[playerid][HospitalTime] = 60;
        SetSpawnInfo(playerid, NO_TEAM, PlayerDB[playerid][DeathSkin], -2653.3843,637.0585,244.3842, 1.7319, 0, 0, 0, 0, 0, 0);
        ResetPlayerWeaponsEx(playerid);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerInterior(playerid, 0);
        SpawnPlayer(playerid);
     }
    return 1;
}
I have also tried to check on playerspawn if the player is dead, if he is then respawn, same stuff going on, trying putting the deadh checker on onplayerdeath and in the timer same stuff..

Any ideas ?

AND YEAH I KNOW SORRY FOR MY CRAPPY ENGLISH

Cheers guys


Re: Timer after the player dies - introzen - 29.03.2019

This seems to be unused.
pawn Code:
new bool:IsDead;
If you were to use it, surely you'd have to do
pawn Code:
new bool:IsDead[MAX_PLAYERS];
What is your intention with the timer? If you want the player to spawn inside the hospital, you should not set
pawn Code:
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);



Re: Timer after the player dies - chiornyybumer - 29.03.2019

Quote:
Originally Posted by introzen
View Post
This seems to be unused.
pawn Code:
new bool:IsDead;
If you were to use it, surely you'd have to do
pawn Code:
new bool:IsDead[MAX_PLAYERS];
What is your intention with the timer? If you want the player to spawn inside the hospital, you should not set
pawn Code:
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
i love you, thank you so much, the [MAX_PLAYERS] is what I needed, thank youuuu


Re: Timer after the player dies - chiornyybumer - 29.03.2019

Quote:
Originally Posted by Y_Less
View Post
You don't need a timer to show the death animation - that should be the default behaviour unless you've changed something. And use SetSpawnInfo in OnPlayerDeath.
It was the [MAX_PLAYERS], and yep it is complicated here, would of uploaded whole code, but it's in different language, and it was using the setspawninfo haha, you both just done what I was tryin to do for 2hours, thank you