Jump to content

Help with events


xXMADEXx

Recommended Posts

Posted

Hey guys, im making basic script, and for some reason the event "onClientRender" isn't getting the players height...

ClientCode:

function checkHight() 
    local x,y,z = getElementPosition(localPlayer) 
    if (z < 35) and (z > 50) then 
        stopBummperCarsHeightChecker() 
    end 
end 
  
function startHeightChecking() 
    addEventHandler("onClientRender", root, checkHight) 
end 
addEvent("events:startBummperCarsHeightChecker", true) 
addEventHandler("events:startBummperCarsHeightChecker", root, startHeightChecking) 
  
function stopBummperCarsHeightChecker() 
    removeEventHandler("onClientRender", root, checkHight) 
    triggerServerEvent("events:bummperCars.PlayerOverHeightLimit", localPlayer) 
end 
  

ServerCode *Not All*:

addCommandHandler("bump", 
function (p) 
riggerClientEvent(p, "events:startBummperCarsHeightChecker", p) 
end 
) 
  
function killPedReasonLeftPlatform() 
    local car = getPedOccupiedVehicle(source) 
    setElementHealth(source, 0) 
    destroyElement(car) 
end 
addEvent("events:bummperCars.PlayerOverHeightLimit",true) 
addEventHandler("events:bummperCars.PlayerOverHeightLimit", root, killPedReasonLeftPlatform) 

Posted

You have "riggerClientEvent" instead of triggerClientEvent in serverside.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Oh. I don't see another error in your code, just that.

Maybe the condition at line 3 makes no sense.

Please do not PM me with scripting related question nor support, use the forums instead.

  • Moderators
Posted

Maybe you should check the car height instead?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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...