SA-MP Forums Archive
Random spawns + Blueberry for 0.3s - 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 spawns + Blueberry for 0.3s (/showthread.php?tid=94858)



Random spawns + Blueberry for 0.3s - XtremeChio - 01.09.2009

Hey,

Here is my code for random teleports.

pawn Код:
new Float:RandomSpawns[8][] =
{
{2605.8538,1692.6309,10.9766,89.5908},
{2518.4373,2155.6116,10.8125,105.7287},
{2031.8082,1919.0184,12.3359,266.4507},
{2024.7225,1545.3295,10.8188,267.9994},
{1958.4229,1342.8798,15.3746,269.7039},
{2090.7458,1163.3665,11.6552,55.1922},
{2800.9646,1326.1124,10.8984,267.8501},
{2119.4382,2218.6707,10.8203,181.3983}
};
This is placed outside of a callback, ofcourse.

And this is the code placed OnPlayerSpawn.

pawn Код:
new randomspawn;
  randomspawn = random(sizeof(RandomSpawns));
  SetPlayerPos(playerid,RandomSpawns[randomspawn][0],RandomSpawns[randomspawn][1],RandomSpawns[randomspawn][2]);
Now whenever someone spawns, he sees Blueberry for quick time, like 0.3 seconds, then he spawns at the random place. How to fix it ? What's wrong in my code.


Re: Random spawns + Blueberry for 0.3s - Jakku - 01.09.2009

I think you can't fix it.


Re: Random spawns + Blueberry for 0.3s - XtremeChio - 01.09.2009

Hm, I've seen servers with it, never saw any Blueberry stuff or this

So if anyone knows, please ..


Re: Random spawns + Blueberry for 0.3s - LuxurioN™ - 01.09.2009



Try:

pawn Код:
new Float:RandomSpawn[7][3] = //[7] = amount of coords [4] = size of string
 {  /*X*/   /*Y*/  /*Z*/
 {2605.8538,1692.6309,10.9766}, // 0
 {2518.4373,2155.6116,10.8125}, // 1
 {2031.8082,1919.0184,12.3359}, // 2
 {2024.7225,1545.3295,10.8188}, // 3
 {1958.4229,1342.8798,15.3746}, // 4
 {2090.7458,1163.3665,11.6552}, // 5
 {2800.9646,1326.1124,10.8984}, // 6
 {2119.4382,2218.6707,10.8203} // 7
};
In OnPlayerSpawn(...)

[/pawn]new Spawn;
Spawn = random(sizeof(RandomSpawn));

SetPlayerPos(playerid, RandomSpawn[Spawn][0], RandomSpawn[Spawn][1], RandomSpawn[Spawn][2]);[/pawn]


Re: Random spawns + Blueberry for 0.3s - MadeMan - 01.09.2009

I think you have set the spawning pos to somewhere in Blueberry in AddPlayerClass. So it first spawns there and then player will be teleported to random place. Maybe you can use SetSpawnInfo to prevent it from teleporting to Blueberry first.


Re: Random spawns + Blueberry for 0.3s - XtremeChio - 01.09.2009

It's actually 8, the number of coordinates, and 4 size of the string :P

I tried, maybe it fixed a bit, but I still see it just for a bit. I know it's possible so you dont see it cause I saw it.

Thanks for the help tho


@MadeMan

Nope, there are no Blueberry spawns, just in LV I'll try with the SetSpawnInfo, thanks.



Re: Random spawns + Blueberry for 0.3s - MadeMan - 01.09.2009

if your AddPlayerClass spawn coords are 0, 0, 0, 0 then it is in Blueberry


Re: Random spawns + Blueberry for 0.3s - XtremeChio - 01.09.2009

Yes I just remember I put the All skins code like 3 hours ago!

And yes, it has extacly 0,0,0,0 coordinates.

Looks like this

pawn Код:
for(new i = 0; i < 299; i++)
  {
    if(IsValidSkin(i))
    {
      AddPlayerClass(i,0.0,0.0,0.0,0.0,24,100,29,50,-1,-1);
    }
  }
But, can I remove it somehow ? It's really annoying.


Re: Random spawns + Blueberry for 0.3s - MadeMan - 01.09.2009

You can't remove these coords from AddPlayerClass.


Re: Random spawns + Blueberry for 0.3s - Kyeno - 03.02.2010

My approach (untested, going to try writing it right now) would be randomizing spawns and using SetPlayerSpawnInfo() in OnPlayerDeath() callback and leaving OnPlayerSpawn() untouched.