SA-MP Forums Archive
Random spawn in dm - 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: Random spawn in dm (/showthread.php?tid=249242)



Random spawn in dm - IvancheBG - 17.04.2011

How can i make when somebody join dm2 to spawn him in random position in the dm and when i kill somebody the player spawn in random position.


Re: Random spawn in dm - Stigg - 17.04.2011

Quote:
Originally Posted by IvancheBG
Посмотреть сообщение
How can i make when somebody join dm2 to spawn him in random position in the dm and when i kill somebody the player spawn in random position.
https://sampwiki.blast.hk/wiki/Random


Re: Random spawn in dm - IvancheBG - 17.04.2011

thanks stigg but can you tell me how i cant understand in the wiki sorry but i am a noob


Re: Random spawn in dm - nemesis_567 - 17.04.2011

Are you asking for something like this

pawn Код:
OnPlayerDeath(playerid)
{
    SetPVarInt(playerid, "ToSpawnAfterDeath", 1);
return 1;
}
OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid) == 1)
    {
        new rand=random(4)//you can change 4 for the number of positions you have
        switch(rand)
        {
             case 0:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.ґ
             case 1:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
             case 2:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
             case 3:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.


        }
    }
}
And if you want him to spawn randomly every time he spawns, just leave it like this:

[pawn]
Are you asking for something like this

pawn Код:
OnPlayerDeath(playerid)
{
    SetPVarInt(playerid, "ToSpawnAfterDeath", 1);
return 1;
}
OnPlayerSpawn(playerid)
{
        new rand=random(4)//you can change 4 for the number of positions you have
        switch(rand)
        {
             case 0:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.ґ
             case 1:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
             case 2:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.
             case 3:SetPlayerPos(playerid, X, Y, Z); // WHERE X, Y and Z are the coordinates of the place where you want him to spawn so is a must change.


        }
}



Re: Random spawn in dm - Alby Fire - 17.04.2011

As the wiki says
pawn Код:
new Float:RandomSpawn[][4] = {
    {X, Y, Z, ANGLE},
    {X, Y, Z, ANGLE},
    {X, Y, Z, ANGLE}
}
Change the coordinates and add so many "{X, Y, Z, ANGLE}," as your random spawns number
Then put
pawn Код:
public OnPlayerSpawn(playerid) {
    new
         rand = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    return 1;
}



Re: Random spawn in dm - blackwave - 17.04.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
     if(PlayerInDm[playerid] == 1)
{
     switch(random(6)) // Number of positions which the switch will random
     {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
      }
}
      return 1;
}



Re: Random spawn in dm - nemesis_567 - 17.04.2011

That's more efficient unless you will only use that thing once, if you are there is no point.


Re: Random spawn in dm - [M.A]Angel[M.A] - 17.04.2011

This is respawn on dm? i need it please.


Re: Random spawn in dm - IvancheBG - 17.04.2011

i want it on dm


Re: Random spawn in dm - [M.A]Angel[M.A] - 18.04.2011

Yeah me too ,I think it's hard to make it :S
___________________

xXx Stunt Paradise Awesome
----174.112.72.38:7777----