Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. class SafeZone
  2. {
  3. vector SAFEZONE_LOACTION = "3702.01 0 5987.87";//Map coords (position of the safe zone)
  4. float SAFEZONE_RADIUS = 300 //In meter
  5. string ENTRY_MESSAGE = "Vous etes dans la Safe Zone!";
  6. string EXIT_MESSAGE = "Vous sortez de la Safe Zone, soyez prudents!";
  7. void SafeZone()
  8. {
  9.  
  10. }
  11.  
  12. void ~SafeZone()
  13. {
  14.  
  15. }
  16.  
  17. void SafeZoneHandle()
  18. {
  19.  
  20. ref array<Man> players = new array<Man>;
  21. GetGame().GetPlayers( players );
  22.  
  23. for ( int i = 0; i < players.Count(); i++ ){
  24.  
  25. float distance;
  26. string ZoneCheck, GUID;
  27.  
  28. Man player = players[i];
  29.  
  30. GUID = player.GetIdentity().GetPlainId(); //Steam 64
  31. Param1<string> Msgparam;
  32.  
  33. distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
  34. if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
  35. {
  36. g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
  37. if (ZoneCheck == "true") //Already in zone
  38. {
  39. player.SetHealth(100);
  40. }
  41. else
  42. {
  43. g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
  44. Msgparam = new Param1<string>( ENTRY_MESSAGE );
  45. GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
  46. }
  47. }
  48. else if (distance > SAFEZONE_RADIUS)
  49. { g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
  50. if (ZoneCheck == "false")
  51. {
  52. return;
  53. }
  54. else
  55. {
  56. g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
  57. Msgparam = new Param1<string>( EXIT_MESSAGE );
  58. GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
  59. }
  60.  
  61. }
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement