ItsMods

Full Version: ****** ** spawns in FFA with 18 slots
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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. }
(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?
(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?
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
(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 )
(02-12-2013, 19:26)SailorMoon Wrote: [ -> ]It will work.
Maybe i'll write plugin for this. ( tomorrow Troll )
Any news?
@sailormoon If you are, make sure to check there are no other (enemy) clients within a radius of 10 meter.
(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.
(02-15-2013, 11:25)SailorMoon Wrote: [ -> ]I know it already, i'll try to make this plugin now.
Any news on this?
(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
Pages: 1 2 3