Random spawn in dm
#1

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.
Reply
#2

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
Reply
#3

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

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.


        }
}
Reply
#5

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;
}
Reply
#6

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;
}
Reply
#7

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

This is respawn on dm? i need it please.
Reply
#9

i want it on dm
Reply
#10

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)