T-Raw/Tyga Posted February 28, 2015 Share Posted February 28, 2015 Well,This is my script when a player enter a vehicle (infernus) a marker get created and when he heat it he gets monney + he can lock the car but its not working so pleaser help me [lua] addEventHandler( "onPlayerWasted", getRootElement(), dead) function dead ( thePlayer ) if getTeamName( getPlayerTeam( thePlayer ) ) == "Police" and isPlayerInVehicle ( thePlayer ) then destroyElement(bankVehicle) destroyElement(bank) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), planeEnter ) function planeEnter ( theVehicle, seat, jacked ) local id = getElementModel ( theVehicle ) if id == 519 or id == 411 then local bank = createMarker ( 2430.5231933594, 2368.6953125, 10.671875, "cylinder", 1.5, 255, 255, 0, 170 ) end end -- add the event handler to the event function lockcar ( thePlayer ) bankVehicle = getPlayerOccupiedVehicle ( thePlayer ) if ( bankVehicle ) then if isVehicleLocked ( playervehicle ) then setVehicleLocked ( playervehicle, false ) else setVehicleLocked ( playervehicle, true ) end end end function bindLockOnSpawn ( theSpawnpoint ) -- w bindKey ( source, "l", "down", lockcar ) end addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) addEventHandler( "onMarkerHit", bank, MarkerHit) function MarkerHit( thePlayer, matchingDimension ) if getTeamName( getPlayerTeam( thePlayer ) )== "Police" and isPlayerInVehicle ( thePlayer ) then givePlayerMoney ( thePlayer, 4000 ) outputChatBox("Delievery done", thePlayer) destroyElement(bankVehicle) destroyElement(bank) end end addEventHandler( "onVehicleExplode", getRootElement(), blow) function blow ( thePlayer ) if isPlayerInVehicle ( thePlayer ) then destroyElement(bankVehicle) destroyElement(bank) outputChatBox("Failed", thePlayer) end end [/lua] Link to comment
Ab-47 Posted February 28, 2015 Share Posted February 28, 2015 function bindLockOnSpawn ( theSpawnpoint ) -- w bindKey ( source, "l", "down", lockcar ) end addEventHandler ( "onResourceStart", getRootElement(), bindLockOnSpawn ) Try this. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now