SA-MP Forums Archive
Spawn His Place When Died - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawn His Place When Died (/showthread.php?tid=137219)



Spawn His Place When Died - AK47317 - 28.03.2010

hello,

i asking what is the code to player spawn back after he die in dm


Re: Spawn His Place When Died - jamesbond007 - 28.03.2010

...

use pawno


Re: Spawn His Place When Died - Sascha - 28.03.2010

ehm what do you mean?..
if a player dies he spawns automatically at the spawn point lol...



Re: Spawn His Place When Died - Norck - 28.03.2010

Quote:
Originally Posted by Sascha
ehm what do you mean?..
if a player dies he spawns automatically at the spawn point lol...
Maybe he means that if you die in DM minigame, you will be spawned at the place where you entered this minigame.
AK47317, explain more about thing that you want and we'll help you


Re: Spawn His Place When Died - Sascha - 28.03.2010

hm...yea possible..in this case do:
this at the defines and so on..
Код:
enum PlayerInfo
{
Spawnx,
Spawny,
Spawnz,
Face
}
new PlayerData[MAX_PLAYERS][PlayerInfo];
then do that at OnPlayerDeath:
Код:
new Float:Coords[3];
GetPlayerPos(playerid, Coords[1], Coords[2], Coords[3]);
PlayerData[playerid][Spawnx] = Coords[1];
PlayerData[playerid][Spawny] = Coords[2];
PlayerData[playerid][Spawnz] = Coords[3];
PlayerData[playerid][Face] = GetPlayerFacingAngle(playerid);
Then: OnPlayerSpawn
Код:
SetPlayerPos(playerid, PlayerData[playerid][Spawnx], PlayerData[playerid][Spawny], PlayerData[playerid][Spawnz]);
SetPlayerFacingAngle(playerid, PlayerData[playerid][Face]);
i guess that could work.. (if you mean what Sinyavski said)...

ah and btw..please correct it, if i made a mistake:P


Re: Spawn His Place When Died - Norck - 28.03.2010

Quote:
Originally Posted by Sascha
ah and btw..please correct it, if i made a mistake:P
Yes, you made
Код:
enum PlayerInfo
{
Float:Spawnx,//Should be Float
Float:Spawny,//Should be Float
Float:Spawnz,//Should be Float
Float:Face//Should be Float
}
new PlayerData[MAX_PLAYERS][PlayerInfo];
And here:
Код:
new Float:Coords[3];
GetPlayerPos(playerid, Coords[0], Coords[1], Coords[2]);//First coords should be with "Zero"
PlayerData[playerid][Spawnx] = Coords[0];//Zero
PlayerData[playerid][Spawny] = Coords[1];
PlayerData[playerid][Spawnz] = Coords[2];
Now someone, correct me, if i made it wrong xD


Re: Spawn His Place When Died - AK47317 - 29.03.2010

well if some one get killed in dm that people spawn back in that dm if he do /exitdm he will spawn back to main world


Re: Spawn His Place When Died - AK47317 - 16.04.2010

First:: ok i have found the error and i have fix it thx

Second:k there something weird when some one join and spawn the charter he go to underworld what the heck


Re: Spawn His Place When Died - Think - 16.04.2010

AK47317 just make a check if he is in the DM or not;

@Top
pawn Код:
new playerisindm[MAX_PLAYERS] = 0;
@OnPlayerConnect:
pawn Код:
playerisindm[playerid] = 0;
@DM Command:
pawn Код:
if(playerisindm[playerid])
{
 // Player is in dm, dont teleport him?
}
else
{
 // Teleport the player to the DM
 playerisindm[playerid] = 1;
}
@OnPlayerDeath
pawn Код:
if(playerisindm[playerid])
{
 // Spawn in DM
 SetPlayerPos(playerid, PlayerData[playerid][Spawnx], PlayerData[playerid][Spawny], PlayerData[playerid][Spawnz]);
 SetPlayerFacingAngle(playerid, PlayerData[playerid][Face]);
}
else
{
 // Spawn normally
}



Re: Spawn His Place When Died - AK47317 - 17.04.2010

is it true if the code like this at OnPlayerSpawn



Код:
if(DMZone[playerid] == 0)
	{
	  SetPlayerPos(playerid, PlayerData[playerid][Spawnx], PlayerData[playerid][Spawny], PlayerData[playerid][Spawnz]);
		SetPlayerFacingAngle(playerid, PlayerData[playerid][Face]);
	}