Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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) {
- return x > min_x && y > min_y && z > min_z && x < max_x && y < max_y && z < max_z;
- }
- new gRespawnTimer[MAX_PLAYERS] = {-1, ...};
- new bool: gPlayerInZone[MAX_PLAYERS char];
- public OnPlayerUpdate(playerid) {
- new Float: x, Float: y, Float: z;
- GetPlayerPos(playerid, x, y, z);
- if (IsPointInArea(x, y, z, ...)) {
- gPlayerInZone{playerid} = true;
- if (!gRespawnTimer[playerid] != -1) {
- if (IsPlayerInAnyVehicle(playerid)) {
- gRespawnTimer[playerid] = SetTimerEx("Respawn", 4000, false, "i", playerid);
- }
- }
- } else {
- gPlayerInZone{playerid} = false;
- }
- return 1;
- }
- forward Respawn(playerid);
- public Respawn(playerid) {
- gRespawnTimer[playerid] = -1;
- if (!gPlayerInZone{playerid}) {
- return;
- }
- if (!IsPlayerInAnyVehicle(playerid)) {
- return;
- }
- SetVehicleToRespawn(GetPlayerVehicleID(playerid));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement