Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. IsPointInArea(Float: x, Float: y, Float: z, Float: min_x, Float: min_y, Float: min_z, Float: max_x, Float: max_y, Float: max_z) {
  2. return x > min_x && y > min_y && z > min_z && x < max_x && y < max_y && z < max_z;
  3. }
  4.  
  5. new gRespawnTimer[MAX_PLAYERS] = {-1, ...};
  6. new bool: gPlayerInZone[MAX_PLAYERS char];
  7.  
  8. public OnPlayerUpdate(playerid) {
  9. new Float: x, Float: y, Float: z;
  10.  
  11. GetPlayerPos(playerid, x, y, z);
  12.  
  13. if (IsPointInArea(x, y, z, ...)) {
  14. gPlayerInZone{playerid} = true;
  15.  
  16. if (!gRespawnTimer[playerid] != -1) {
  17. if (IsPlayerInAnyVehicle(playerid)) {
  18. gRespawnTimer[playerid] = SetTimerEx("Respawn", 4000, false, "i", playerid);
  19. }
  20. }
  21. } else {
  22. gPlayerInZone{playerid} = false;
  23. }
  24. return 1;
  25. }
  26.  
  27. forward Respawn(playerid);
  28. public Respawn(playerid) {
  29. gRespawnTimer[playerid] = -1;
  30.  
  31. if (!gPlayerInZone{playerid}) {
  32. return;
  33. }
  34.  
  35. if (!IsPlayerInAnyVehicle(playerid)) {
  36. return;
  37. }
  38.  
  39. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement