Jump to content

Get the driver and my seat


myonlake

Recommended Posts

Posted (edited)

Hey again,

I would like to know the functions that I would need to use to detect the driver seat player and mine. I would like to give the driver some money when I enter as a passenger.

So, give me the functions and I'll try to fix my script.

PS.

What about the "toggleCameraFixedMode", it looks like to not be working anymore, what's the new one? No fix at Wiki.

Thanks

Edited by myonlake
Posted
getPedOccupiedVehicle -- getting a ped's vehicle 
getPedOccupiedVehicleSeat -- getting a ped's seat 
getVehicleController -- getting vehicle's controller/driver 

Posted

Well, I got this far.

function giveMoneyToTaxi(player, seat, jacked) 
    local seat = getPedOccupiedVehicleSeat(player) 
    local veh = getPedOccupiedVehicle(player) 
    local occupants = getVehicleOccupants(veh) 
    local driver = getVehicleOccupant(veh) 
     
    taxi = {[420]=true, [438]=true} 
    skin = {[253]=true, [255]=true} 
     
    if (driver) and (taxi[getElementModel(source)]) and (not skin[getElementModel(player)]) and (not seat == 0) then 
        givePlayerMoney(source) 
    else 
        return false 
    end 
end 
addEventHandler("onPlayerVehicleEnter", rElement, giveMoneyToTaxi) 

5, 6, 7, 8 lines doing errors.

Don't tell me that it's a minor error now :D

Posted

That's because "player" is not a player element, "source" is the player element of onPlayerVehicleEnter.

  
function giveMoneyToTaxi(veh, seat, jacked) 
    local seat = getPedOccupiedVehicleSeat(source) 
    local occupants = getVehicleOccupants(veh) 
    local driver = getVehicleOccupant(veh) 
    
    taxi = {[420]=true, [438]=true} 
    skin = {[253]=true, [255]=true} 
    
    if (driver) and (taxi[getElementModel(veh]) and (not skin[getElementModel(source)]) and (not seat == 0) then 
        givePlayerMoney(source, 1) 
    else 
        return false 
    end 
end 
addEventHandler("onPlayerVehicleEnter", rElement, giveMoneyToTaxi) 

Try with that.

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