Advertisement
Lordz

[YG]L69 - DB protection

Mar 3rd, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.95 KB | None | 0 0
  1. #include "a_samp"
  2. #include "zcmd"
  3.  
  4. #define CMD_L69 //For command : "telel69" undefine this to disable that command.
  5. new L69;
  6. new lpwep[MAX_PLAYERS][13][2];
  7. new ldb[MAX_PLAYERS];
  8.  
  9. #define red 0xFF0000FF
  10.  
  11. #define Lymin 566.1470
  12. #define Lymax 708.0251
  13. #define Lxmin -2748.1877
  14. #define Lxmax -2524.6787
  15.  
  16. stock GetPlayerArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY) //Creating a stock to get player's area. Thanks to SA-MP forums for the AreaCheck.
  17. {
  18.     new Float:X, Float:Y, Float:Z;
  19.  
  20.     GetPlayerPos(playerid, X, Y, Z);
  21.     if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY)
  22.     {
  23.         return 1;
  24.     }
  25.     return 0;
  26. }
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.  printf("");
  31.  printf("__________________________________________________________");
  32.  printf("");
  33.  printf("YoUnG Generations Driveby protection Loading...");
  34. // L69 = GangZoneCreate(-2748.1877,566.1470,-2524.6787,708.0251);
  35.  L69 = GangZoneCreate(Lxmin, Lymin, Lxmax, Lymax);
  36.  for(new i; i< GetMaxPlayers(); i++)
  37.  {
  38.   if(IsPlayerConnected(i))
  39.   {
  40.    GangZoneShowForPlayer(i, L69, 0xFF9900AA);
  41.   }
  42.  }
  43.  printf("YoUnG Generations Driveby protection loaded successfully!");
  44.  printf("__________________________________________________________");
  45.  return 1;
  46. }
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50.  GangZoneShowForPlayer(playerid, L69, 0xFF9900AA);
  51.  return 1;
  52. }
  53.  
  54. public OnPlayerDisconnect(playerid)
  55. {
  56.  GangZoneHideForPlayer(playerid, L69);
  57.  return 1;
  58. }
  59.  
  60. public OnPlayerStateChange(playerid, newstate, oldstate)
  61. {
  62.  new vehicleid = GetPlayerVehicleID(playerid);
  63.  if(vehicleid != INVALID_VEHICLE_ID) {
  64.  if(GetPlayerArea(playerid, Lxmin, Lymin, Lxmax, Lymax)) {
  65.  if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38) {
  66.  if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  67.  {
  68.   for(new i = 0; i< 13; i++)
  69.   {
  70.    GetPlayerWeaponData(playerid, i, lpwep[playerid][i][0], lpwep[playerid][i][1]);
  71.    ldb[playerid] = 1;
  72.   }
  73.   ResetPlayerWeapons(playerid);
  74.   SendClientMessage(playerid, red, "Your weapons have been resetted as your in a vehicle on driveby restricted areas!");
  75.  }
  76.  }
  77.  }
  78.  }
  79.  return 1;
  80. }
  81.  
  82. public OnPlayerExitVehicle(playerid, vehicleid)
  83. {
  84.  if(ldb[playerid] == 1)
  85.  {
  86.   for(new i = 0; i< 13; i++)
  87.   {
  88.    GivePlayerWeapon(playerid, lpwep[playerid][i][0], lpwep[playerid][i][1]);
  89.    ldb[playerid] = 0;
  90.   }
  91.  }
  92.  return 1;
  93. }
  94.  
  95. public OnPlayerUpdate(playerid)
  96. {
  97.  if(IsPlayerInAnyVehicle(playerid))
  98.  {
  99.   if(GetPlayerArea(playerid, Lxmin, Lymin, Lxmax, Lymax))
  100.   {
  101.    if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38)
  102.    {
  103.    for(new i = 0; i< 13; i++)
  104.    {
  105.     GetPlayerWeaponData(playerid, i, lpwep[playerid][i][0], lpwep[playerid][i][1]);
  106.    }
  107.    ResetPlayerWeapons(playerid);
  108.    ldb[playerid] = 1;
  109.    }
  110.   }
  111.  }
  112.  return 1;
  113. }
  114.  
  115. #if defined L69_CMD
  116. CMD:telel69(playerid, params[])
  117. {
  118.  SetPlayerPos(playerid, -2526.9819,625.6696,28.0642);
  119.  return 1;
  120. }
  121. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement