Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help OnPlayerSpawned()
#21
removed
Reply

#22
CSHARP Code
  1. //ClientNum, AddonFrame cycles
  2. Dictionary<int, int> ProcessSpawn = new Dictionary<int, int>();
  3. public override void OnPlayerSpawned(ServerClient Client)
  4. {
  5. ProcessSpawn.Add(Client.ClientNum, 2/*seconds*/ * 1000 / AddonFrameInterval);
  6. }
  7.  
  8. public override void OnAddonFrame()
  9. {
  10. List<int> PSKeys = new List<int>(ProcessSpawn.Keys);
  11. foreach (int key in PSKeys)
  12. {
  13. ProcessSpawn[key]--;
  14. if (ProcessSpawn[key] == 0)
  15. {
  16. ServerClient spawnedPlayer = GetClient(key);
  17. //do stuff here
  18. try
  19. {
  20. if (spawnedPlayer.Team == Teams.Axis)
  21. {
  22. spawnedPlayer.Other.Health = 165;
  23. spawnedPlayer.Other.SpeedScale = (float)1.12;
  24. }
  25. //Thread.Sleep(200);
  26. if (spawnedPlayer.XUID == "011000xxxx")
  27. {
  28. if (spawnedPlayer.Team == Teams.Allies)
  29. {
  30. int awwep = GetWeapon("iw5_fad_mp_camo02");
  31. int awwep2 = GetWeapon("iw5_riotshieldjugg_mp");
  32. spawnedPlayer.Other.PrimaryWeapon = awwep;
  33. spawnedPlayer.Other.SecondaryWeapon = awwep2;
  34. spawnedPlayer.Other.Health += 560;
  35. }
  36. if (spawnedPlayer.Team == Teams.Axis)
  37. {
  38. spawnedPlayer.Other.SpeedScale = (float)2.0;
  39. }
  40. }
  41. }
  42. catch (Exception e)
  43. {
  44. ServerPrint("Error in test: \n" +
  45. e.Message + "\n" +
  46. e.StackTrace + "\n" +
  47. e.Source + "\n" +
  48. e.InnerException + "\n" +
  49. e.HelpLink);
  50. }
  51. //end custom stuff
  52. ProcessSpawn.Remove(key);
  53. }
  54. }
  55. }
[Image: azuw.jpg]
Reply

#23
thank you! I made a mistake in the initial code Tongue

all ingenious is simple!
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Error using OnPlayerSpawned JoSchaap 6 2,946 03-17-2012, 15:29
Last Post: JoSchaap

Forum Jump:


Users browsing this thread:
8 Guest(s)

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