Jump to content

map limit script


Faw[Ful]

Recommended Posts

This script blow the player car when the player exit the map limit :

function killimit (player) 
  
if getLocalPlayer() == player then 
    pvehicle = getPedOccupiedVehicle(player) 
             x,y,z = getElementPosition( pvehicle ) 
        if z > 800 or z < -800 or x > 4000 or x < -4000 or y > 4000 or y < -4000 then 
                    blowVehicle ( pvehicle ) 
                    end 
                    end 
                    end 
                    setTimer(killimit, 1000, 0) 
                     
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), killimit) 

It d'ont work I try many things , but I cannot find the errors. Client side script

Link to comment
  • Discord Moderators
function killimit() 
    pvehicle = getPedOccupiedVehicle(localPlayer) 
    if not pvehicle then return end 
     
    x,y,z = getElementPosition(pvehicle) 
    if z > 800 or z < -800 or x > 4000 or x < -4000 or y > 4000 or y < -4000 then 
        blowVehicle ( pvehicle ) 
    end 
end 
setTimer(killimit, 1000, 0) 

I suppose this is what you want? You need to look up the functions and events you use. And what they pass as parameters. In a clientside script, localPlayer or getLocalPlayer() always returns the controlling player.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...