SA-MP Forums Archive
Changing spawns - 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: Changing spawns (/showthread.php?tid=193299)



Changing spawns - Baboon - 25.11.2010

Hi,

Well I have some maps in a TDM with spawns. Well these spawns (of 2 teams) have to change each 6 minuts. But the teams still have to challenge eachother. So no SetTimer.. Cus thats per person different. The spawns have to change each 6 minuts and the server controlls that... So even when noone is only, the spawns changes.

Can someone give me a script for this? thanks!!!!!!!!


Re: Changing spawns - Nero_3D - 25.11.2010

As far as I understood

- The spawn change each 6 minutes ( for all )
- The players wont be moved

Is that correct ?


Re: Changing spawns - Baboon - 25.11.2010

well the players should be moved... They should go to another spawn and that has to be saved in the server... With other words:the class selection has to be changed every 6 minuts. (2 classes). When you join the game, the class selection is also changed, so everybody will be in the same map and spawn at the same place as his/her team.


Re: Changing spawns - Ash. - 25.11.2010

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
As far as I understood

- The spawn change each 6 minutes ( for all )
- The players wont be moved

Is that correct ?
Seems it



You can use SetTimerEx

eg,

pawn Код:
#define ChangingTeam1 0
#define ChangingTeam2 1

enum SpawnInfo {Float:x, Float:y, Float:z}
new SpawnArray[SpawnInfo][] = {
 {123.123, 123.123, 123.123}, //I have no idea where this is
 {321.321, 321.321, 321.321}  //I have no idea where this is either
}

forward Spawn(playerid);
public Spawn(playerid)
{
     for(new i; i < GetMaxPlayers(); i++)
     {
          if(GetPlayerTeam(playerid) == ChangingTeam1)
          {
               new rand = random(sizeof(SpawnInfo));
               SetPlayerPos(playerid, SpawnInfo[rand][x], SpawnInfo[rand][y], SpawnInfo[rand][z]);
               SendClientMessage(playerid, [A COLOUR], "You were respawned elsewhere");
          }
          else if(GetPlayerTeam(playerid) == ChangingTeam2)
          {
               new rand = random(sizeof(SpawnInfo));
               SetPlayerPos(playerid, SpawnInfo[rand][x], SpawnInfo[rand][y], SpawnInfo[rand][z]);
          }
     }
}

//Then

public OnPlayerSpawn(playerid)
{
     SetTimerEx("Spawn", false, "i", playerid);
     return 1;
}
The 'Spawn' Timer could also be:

pawn Код:
forward Spawn(playerid);
public Spawn(playerid)
{
     for(new i; i < GetMaxPlayers(); i++)
     {
          if(GetPlayerTeam(playerid) == ChangingTeam1)
          {
               SpawnPlayer(playerid);
          }
          else if(GetPlayerTeam(playerid) == ChangingTeam2)
          {
               SpawnPlayer(playerid);
          }
     }
}