SA-MP Forums Archive
[Solved] - 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: [Solved] (/showthread.php?tid=111622)



[Solved] - Ace_Menace - 02.12.2009

Here's My Code:

pawn Код:
if(SpawnX[playerid] != 0.0 && SpawnY[playerid] != 0.0 && SpawnZ[playerid] != 0.0)
SetPlayerPos(playerid, SpawnX[playerid], SpawnY[playerid], SpawnZ[playerid]);
Now I want to turn that into this:

pawn Код:
SetPlayerCheckpoint(i, SpawnX[deadplayer], SpawnY[deadplayer], SpawnZ[deadplayer]);



Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Grim_ - 02.12.2009

You're trying to get where someone spawned and set that as a checkpoint for another player?


Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Ace_Menace - 02.12.2009

Yes.


Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Ace_Menace - 02.12.2009

The trick is, getting something to go in-place for the SetPlayerCheckpoint(playerid...);

Because it's not a command to set the checkpoint.


Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Grim_ - 02.12.2009

Are you trying to do it if Player_A killed Player_B, so now Player_A gets the checkpoint?


Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Ace_Menace - 02.12.2009

A Player dies, and a medic automatically gets the checkpoint.


Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Grim_ - 02.12.2009

Okay.
pawn Код:
//top of script after #include <a_samp> and before main()
new HasDied[MAX_PLAYERS];

//This is to make sure they have died and not just entered the server
public OnPlayerDeath(playerid, reason)
{
  HasDied[playerid] = 1;
  return 1;
}

public OnPlayerSpawn(playerid)
{
  if(HasDied[playerid] == 1)
  {
   new Float:X, Float:Y, Float:Z;
   GetPlayerPos(playerid, X, Y, Z);
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
     if(IsMedic[i] == 1) //your variable to check if the player is a medic
     {
      SetPlayerCheckPoint(i, X, Y, Z, 5);
     }
   }
  }
  return 1;
}



Re: [HELP] Returning a Player's Spawn and Using as another player's Checkpoint - Ace_Menace - 02.12.2009

Thank you,
you have guided me, and it now works,

With a few modifications of course.