Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SafeZone
- {
- vector SAFEZONE_LOACTION = "3702.01 0 5987.87";//Map coords (position of the safe zone)
- float SAFEZONE_RADIUS = 300 //In meter
- string ENTRY_MESSAGE = "Vous etes dans la Safe Zone!";
- string EXIT_MESSAGE = "Vous sortez de la Safe Zone, soyez prudents!";
- void SafeZone()
- {
- }
- void ~SafeZone()
- {
- }
- void SafeZoneHandle()
- {
- ref array<Man> players = new array<Man>;
- GetGame().GetPlayers( players );
- for ( int i = 0; i < players.Count(); i++ ){
- float distance;
- string ZoneCheck, GUID;
- Man player = players[i];
- GUID = player.GetIdentity().GetPlainId(); //Steam 64
- Param1<string> Msgparam;
- distance = vector.Distance(player.GetPosition(),SAFEZONE_LOACTION);
- if (distance <= SAFEZONE_RADIUS) //Player Inside Zone
- {
- g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
- if (ZoneCheck == "true") //Already in zone
- {
- player.SetHealth(100);
- }
- else
- {
- g_Game.SetProfileString("SafeZoneStatus"+ GUID, "true");
- Msgparam = new Param1<string>( ENTRY_MESSAGE );
- GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
- }
- }
- else if (distance > SAFEZONE_RADIUS)
- { g_Game.GetProfileString("SafeZoneStatus"+ GUID, ZoneCheck);
- if (ZoneCheck == "false")
- {
- return;
- }
- else
- {
- g_Game.SetProfileString("SafeZoneStatus"+ GUID, "false");
- Msgparam = new Param1<string>( EXIT_MESSAGE );
- GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, player.GetIdentity());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement