Spawn same Place in random Spots
#1

I have here my random spot after I teleport to glass deathmatch

pawn Код:
new Float:RandomSpawnDrag[][] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {-2686.0930,1255.1766,55.2939,0.8892}, // glass dm spawn 1
    {-2692.6455,1255.4932,55.2934,10.5918}, // glass dm spawn 2
    {-2675.6995,1254.8121,55.2935,2.7208}, // glass dm spawn 3
    {-2669.0015,1255.4982,55.2957,357.9764} // glass dm spawn 4
};
The problem is that Everytime I get killed,died or even splat. It always spawn me on my spawning area, How do I change the spawning death in glass deathmatch? So people won't need to type /glass again and again after they got killed.
Reply
#2

pawn Код:
//Under /glass Command
SetPVarInt(playerid,"GlassDM",true);
new r=random(4);
SetPlayerPos(playerid,RandomSpawnDrag[r][0],RandomSpawnDrag[r][1],RandomSpawnDrag[r][2]);
SetPlayerFacingAngle(playerid,RandomSpawnDrag[r][3]);


//Under Exit Command
DeletePVar(playerid,"GlassDM");
SetPlayerPos(.......); //The position to set after leaving the DM


//OnPlayerSpawn
if(GetPVarInt(playerid,"GlassDM"))
{
    new r=random(4);
    SetPlayerPos(playerid,RandomSpawnDrag[r][0],RandomSpawnDrag[r][1],RandomSpawnDrag[r][2]);
    SetPlayerFacingAngle(playerid,RandomSpawnDrag[r][3]);
}
else
{
 //The Rest of Onplayerspawn
}
Reply
#3

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
pawn Код:
//Under /glass Command
SetPVarInt(playerid,"GlassDM",true);
new r=random(4);
SetPlayerPos(playerid,RandomSpawnDrag[r][0],RandomSpawnDrag[r][1],RandomSpawnDrag[r][2]);
SetPlayerFacingAngle(playerid,RandomSpawnDrag[r][3]);


//Under Exit Command
DeletePVar(playerid,"GlassDM");
SetPlayerPos(.......); //The position to set after leaving the DM


//OnPlayerSpawn
if(GetPVarInt(playerid,"GlassDM"))
{
    new r=random(4);
    SetPlayerPos(playerid,RandomSpawnDrag[r][0],RandomSpawnDrag[r][1],RandomSpawnDrag[r][2]);
    SetPlayerFacingAngle(playerid,RandomSpawnDrag[r][3]);
}
else
{
 //The Rest of Onplayerspawn
}
EDIT:
Reply
#4

How do I add this else?

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid,"GrenadeDM"))
    {
    new Random = random(sizeof(RandomSpawnGrenadeDM));
    SetPlayerPos(playerid, RandomSpawnGrenadeDM[Random][0], RandomSpawnGrenadeDM[Random][1], RandomSpawnGrenadeDM[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawnGrenadeDM[Random][3]);
    }
    else
    {
    if(GetPVarInt(playerid,"GlassDM"))
    {
    new Random = random(sizeof(RandomSpawnGlassDM));
    SetPlayerPos(playerid, RandomSpawnGlassDM[Random][0], RandomSpawnGlassDM[Random][1], RandomSpawnGlassDM[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawnGlassDM[Random][3]);
    }
    else
    {
Is this correct?? or basically how do I add more

pawn Код:
if(GetPVarInt(playerid,"GlassDM"))
{
    new r=random(4);
    SetPlayerPos(playerid,RandomSpawnDrag[r][0],RandomSpawnDrag[r][1],RandomSpawnDrag[r][2]);
    SetPlayerFacingAngle(playerid,RandomSpawnDrag[r][3]);
}
I have 4 more left
Reply
#5

like this

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid,"GrenadeDM"))
    {
      new Random = random(sizeof(RandomSpawnGrenadeDM));
      SetPlayerPos(playerid, RandomSpawnGrenadeDM[Random][0], RandomSpawnGrenadeDM[Random][1], RandomSpawnGrenadeDM[Random][2]);
      SetPlayerFacingAngle(playerid, RandomSpawnGrenadeDM[Random][3]);
    }
    else if(GetPVarInt(playerid,"GlassDM"))
    {
      new Random = random(sizeof(RandomSpawnGlassDM));
      SetPlayerPos(playerid, RandomSpawnGlassDM[Random][0], RandomSpawnGlassDM[Random][1], RandomSpawnGlassDM[Random][2]);
      SetPlayerFacingAngle(playerid, RandomSpawnGlassDM[Random][3]);
    }
    else if(......)
    {
    }
    else if(.....)
    {
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
like this

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPVarInt(playerid,"GrenadeDM"))
    {
      new Random = random(sizeof(RandomSpawnGrenadeDM));
      SetPlayerPos(playerid, RandomSpawnGrenadeDM[Random][0], RandomSpawnGrenadeDM[Random][1], RandomSpawnGrenadeDM[Random][2]);
      SetPlayerFacingAngle(playerid, RandomSpawnGrenadeDM[Random][3]);
    }
    else if(GetPVarInt(playerid,"GlassDM"))
    {
      new Random = random(sizeof(RandomSpawnGlassDM));
      SetPlayerPos(playerid, RandomSpawnGlassDM[Random][0], RandomSpawnGlassDM[Random][1], RandomSpawnGlassDM[Random][2]);
      SetPlayerFacingAngle(playerid, RandomSpawnGlassDM[Random][3]);
    }
    else if(......)
    {
    }
    else if(.....)
    {
    }
    return 1;
}
Thanks hussen you saved my script but before I leave, Do I need to change the else to return 1?

Код:
else
{
 //The Rest of Onplayerspawn
}
Reply
#7

what do you mean?
just add return 1 at the end of OnPlayerSpawn
Reply
#8

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
what do you mean?
just add return 1 at the end of OnPlayerSpawn
Fixed my friend! I must use this

Код:
else
{
 //The Rest of Onplayerspawn
   }
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)