dm spawn
#6

Save the position of the player when they die, load it when they respawn, something like this:

Код:
public OnPlayerDeath(playerid)
{
	new Float:pos[3];
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	SetPVarFloat(playerid,"PosX",pos[0]);
	SetPVarFloat(playerid,"PosY",pos[1]);
	SetPVarFloat(playerid,"PosZ",pos[2]);
	SetPVarInt(playerid,"IsResPawn",1);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	if(GetPVarInt(playerid,"IsResPawn") == 1)
	{
		SetPlayerPos(playerid,GetPVarFloat(playerid,"PosX"),GetPVarFloat(playerid,"PosY"),GetPVarFloat(playerid,"PosZ");
		DeletePVar(playerid,"IsResPawn");
	}
	return 1;
}
While it may not be the most optimized code, it should work.

Here's a tutorial about PVars (what we used in the code up here) https://sampforum.blast.hk/showthread.php?tid=163175

Here's a wiki page with nice documentation for starters https://sampwiki.blast.hk/wiki/Control_Structures
Reply


Messages In This Thread
dm spawn - by crukk11 - 02.03.2017, 03:15
Re: dm spawn - by JessThompson - 02.03.2017, 04:24
Re: dm spawn - by Alkymia - 02.03.2017, 04:53
Re: dm spawn - by CXdur - 02.03.2017, 05:58
Re: dm spawn - by crukk11 - 02.03.2017, 12:25
Re: dm spawn - by Toroi - 02.03.2017, 12:56
Re: dm spawn - by crukk11 - 02.03.2017, 14:18
Re: dm spawn - by crukk11 - 02.03.2017, 15:05
Re: dm spawn - by crukk11 - 03.03.2017, 15:59
Re: dm spawn - by crukk11 - 03.03.2017, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)