Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
****** ** spawns in FFA with 18 slots
#11
here's an example of how you can add a random spawn
CSHARP Code
  1. string map = "";
  2. public override void OnMapChange()
  3. {
  4. map = GetDvar("mapname");
  5. }
  6. public override void OnPlayerSpawned(ServerClient Client)
  7. {
  8. Random rnd = new Random();
  9. int spawn;
  10. spawn = rnd.Next(0, 3);
  11.  
  12. if (map == "mp_dome") // the map you want
  13. {
  14. if (spawn == 1)
  15. {
  16. Client.OriginX = 100f; //Change the location to whatever you want
  17. Client.OriginY = 100f;
  18. Client.OriginZ = 100f;
  19. }
  20. if (spawn == 2)
  21. {
  22. Client.OriginX = 200f; //Change the location to whatever you want
  23. Client.OriginY = 200f;
  24. Client.OriginZ = 200f;
  25. }
  26. //etc.
  27. }
  28. }
Reply

#12
(02-11-2013, 21:15)8q4s8 Wrote: here's an example of how you can add a random spawn
Code:
...
Now where do I get the coordinates and what do I have to do with the code?
Reply

#13
(02-11-2013, 21:15)8q4s8 Wrote: here's an example of how you can add a random spawn
CSHARP Code
  1. string map = "";
  2. public override void OnMapChange()
  3. {
  4. map = GetDvar("mapname");
  5. }
  6. public override void OnPlayerSpawned(ServerClient Client)
  7. {
  8. Random rnd = new Random();
  9. int spawn;
  10. spawn = rnd.Next(0, 3);
  11.  
  12. if (map == "mp_dome") // the map you want
  13. {
  14. if (spawn == 1)
  15. {
  16. Client.OriginX = 100f; //Change the location to whatever you want
  17. Client.OriginY = 100f;
  18. Client.OriginZ = 100f;
  19. }
  20. if (spawn == 2)
  21. {
  22. Client.OriginX = 200f; //Change the location to whatever you want
  23. Client.OriginY = 200f;
  24. Client.OriginZ = 200f;
  25. }
  26. //etc.
  27. }
  28. }

It's bad code, what about if enemy camping next to your spawn? Need to do some protection or "smart" spawn system. I think it's easy ( maybe ).
Like create dictionaries or whatever, add positions, make foreach from all clients and if (distance(client.pos, spawnpos) < 200) => Find another spawn spot?
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#14
I know but i thought i give him a code so he got an idea how he could make it. Also tacs won't work with that
Reply

#15
(02-12-2013, 19:25)8q4s8 Wrote: I know but i thought i give him a code so he got an idea how he could make it. Also tacs won't work with that

It will work.
Maybe i'll write plugin for this. ( tomorrow Troll )
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#16
(02-12-2013, 19:26)SailorMoon Wrote: It will work.
Maybe i'll write plugin for this. ( tomorrow Troll )
Any news?
Reply

#17
@sailormoon If you are, make sure to check there are no other (enemy) clients within a radius of 10 meter.
Reply

#18
(02-15-2013, 08:50)JariZ Wrote: @sailormoon If you are, make sure to check there are no other (enemy) clients within a radius of 10 meter.

I know it already, i'll try to make this plugin now.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#19
(02-15-2013, 11:25)SailorMoon Wrote: I know it already, i'll try to make this plugin now.
Any news on this?
Reply

#20
(03-04-2013, 22:38)napok Wrote:
(02-15-2013, 11:25)SailorMoon Wrote: I know it already, i'll try to make this plugin now.
Any news on this?

It is already released LOL

http://www.itsmods.com/forum/Thread-Rele...pawns.html
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Brick [Release] [CODE] Custom spawns Nekochan 22 12,033 03-22-2013, 18:15
Last Post: napok
  [Request] Player slots plugin alex2477 6 4,270 02-25-2013, 13:33
Last Post: JariZ
  Turoial please, how do you add death machine to your slots? Erik The Born 9 5,175 02-15-2013, 21:38
Last Post: Gladio
  reserved slots setman 8 4,240 05-31-2012, 11:34
Last Post: Yamato
  Help Please...(Player slots) alex2477 2 2,160 04-11-2012, 15:33
Last Post: alex2477
  [Request] More Slots movinggun 2 2,213 03-06-2012, 10:12
Last Post: milchshake
  [Request] reserved slots movinggun 7 4,289 03-05-2012, 01:10
Last Post: milchshake
  50 Slots-Goodtimes-Faction PVP-MobArena-Gates-Whitelist-1.0 Stuffing 9 4,634 03-01-2012, 21:52
Last Post: xbedestroyed
  [Tutorial] Giving your server extra slots for free. koil 19 8,252 07-30-2011, 22:59
Last Post: koil

Forum Jump:


Users browsing this thread:
4 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.