Jump to content

Points for something


Mefisto_PL

Recommended Posts

Hi ! I would like to make player can jump in vehicle but if he has 50 points.. I made it but now script isn't working..

function Veh_Jump () 
    local p_Vehicle = getPedOccupiedVehicle ( getLocalPlayer() ) 
    if ( points >= 50 ) then 
        if p_Vehicle and isVehicleOnGround ( p_Vehicle ) then 
        local px, py, pz = getElementVelocity ( p_Vehicle ) 
        setElementVelocity ( p_Vehicle, px, py, pz + 0.7 ) 
        if ( points <= 50 ) then 
        setElementVelocity ( p_Vehicle, px, py, pz ) 
    end 
    end 
end 
end 
bindKey("lshift","down",Veh_Jump) 
addCommandHandler("vehjump", Veh_Jump) 

Link to comment
function Veh_Jump(key, keyState) 
    if(keyState == "down") then 
        local p_Vehicle = getPedOccupiedVehicle(localPlayer) 
        if(points >= 50) then 
            if p_Vehicle and isVehicleOnGround (p_Vehicle) then 
                local px, py, pz = getElementVelocity (p_Vehicle) 
                setElementVelocity (p_Vehicle, px, py, pz + 0.7) 
            end 
        else end 
    end 
end 
bindKey("lshift", "down", Veh_Jump) 
addCommandHandler("vehjump", Veh_Jump) 

try now

Link to comment

This is defined in server-side script

function scorePoints ( ) 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Points") 
    for theKey,thePlayer in ipairs(getElementsByType ( "player" )) do 
    setElementData ( thePlayer, "Points", 0 ) 
end 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(), scorePoints ) 
  
function createPoints ( ) 
    setElementData ( thePlayer, "Points", 0 ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), createPoints ) 

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