Mefisto_PL Posted August 3, 2013 Posted August 3, 2013 Ehh.. I've got a new problem. I made this code and I know that is wrong, because debugscript said that I haven't 3 argument at getElementData. I think that I haven't ID this car or something like that. function nowyPojazd ( vehicle, thePlayer ) local oldVehicle = getElementData ( thePlayer, "vehicle_owner" ) if ( oldVehicle ~= false ) then removeElementData ( oldVehicle, "veh_owner" ) setVehicleLocked ( oldVehicle, false ) end setElementData ( vehicle, "veh_owner", thePlayer ) setElementData ( thePlayer, "vehicle_owner", vehicle ) end addEventHandler ( "onVehicleStartEnter", getRootElement(), nowyPojazd )
Mefisto_PL Posted August 3, 2013 Author Posted August 3, 2013 It doesn't working and I don't know how to fix that :_: Idk what I must use for it.
bandi94 Posted August 3, 2013 Posted August 3, 2013 From when "onVehicleStartEnter" return as first element the vehicle ?? vehicle is the source. function nowyPojazd ( thePlayer ) local oldVehicle = getElementData ( thePlayer, "vehicle_owner" ) if ( oldVehicle ~= false ) then removeElementData ( oldVehicle, "veh_owner" ) setVehicleLocked ( oldVehicle, false ) end setElementData ( source, "veh_owner", thePlayer ) setElementData ( thePlayer, "vehicle_owner", source ) end addEventHandler ( "onVehicleStartEnter", getRootElement(), nowyPojazd )
Mefisto_PL Posted August 3, 2013 Author Posted August 3, 2013 Okay, now 0 errors, but it doesn't making a vehicle owner. ( veh_owner = owner ) ( vehicle_owner = vehicle ) ( pojazd = vehicle ) Full function here: function wlascicielPojazdu ( thePlayer ) local acc = getPlayerAccount ( thePlayer ) if (not acc or isGuestAccount ( acc )) then return end local accName = getAccountName ( acc ) local pojazd = getPedOccupiedVehicle ( thePlayer ) if pojazd and not getElementData ( pojazd, "veh_owner" ) then setElementData ( pojazd, "veh_owner", accName ) setElementData ( thePlayer, "vehicle_owner", pojazd ) end local oldVehicle = getElementData ( thePlayer, "vehicle_owner" ) if ( oldVehicle ~= false ) then removeElementData ( oldVehicle, "veh_owner" ) setVehicleLocked ( oldVehicle, false ) end setElementData ( source, "veh_owner", thePlayer ) setElementData ( thePlayer, "vehicle_owner", source ) end addEventHandler ( "onVehicleStartEnter", getRootElement(), wlascicielPojazdu )
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