Best-Killer Posted December 20, 2015 Share Posted December 20, 2015 bad argument getElementData expected element at argument 1 got nill addEvent("PayClient", true) addEventHandler( "PayClient", root, function() givePlayerMoney(source, 2000) setPlayerWantedLevel(source, getPlayerWantedLevel(source)+1) if getElementData (vehicle, "OwnerOfThisVehicle") == source then destroyElement (vehicle) end end ) Link to comment
Captain Cody Posted December 20, 2015 Share Posted December 20, 2015 where the hell is vehicle defined? Link to comment
Best-Killer Posted December 20, 2015 Author Share Posted December 20, 2015 [/lua]addEvent("givePVehicle", true) addEventHandler( "givePVehicle", root, function() local vehicle = createVehicle (482,1605.42, -1472.97, 13.58,0,0,0) setElementData (vehicle, "OwnerOfThisVehicle", source) warpPedIntoVehicle(source, vehicle) end )[/lua] Link to comment
Captain Cody Posted December 20, 2015 Share Posted December 20, 2015 well in the trigger server side event you need to pass the vehicle, and in the client side you need to retrieve it in the function Link to comment
Best-Killer Posted December 20, 2015 Author Share Posted December 20, 2015 i tried with that function Location2() markerlocation2 = createMarker (-2642.98, 1371.07, 7.16, "cylinder", 4,238, 44, 44, 255) blipSF = createBlipAttachedTo (markerlocation2, 51) addEventHandler( "onClientMarkerHit", markerlocation2, function ( hitPlayer, d ) if isElement(markerlocation2) then destroyElement(markerlocation2) destroyElement(blipSF) end triggerServerEvent("doPayClient2", hitPlayer, localPlayer) end ) end addEvent("finish", true) addEventHandler( "finish", root, function(vehicle) if getElementData ( "OwnerOfThisVehicle") == source then destroyElement (vehicle) end end i got that : expected element at argument 1 got string ownerOfThinsVehicle Link to comment
Addlibs Posted December 21, 2015 Share Posted December 21, 2015 On line 4 of 2nd code you should put vehicle as the first parameter. Link to comment
Best-Killer Posted December 21, 2015 Author Share Posted December 21, 2015 expected element at argument 1 got nill Link to comment
Addlibs Posted December 21, 2015 Share Posted December 21, 2015 Then push an argument when calling that event - don't expect the script to know what vehicle you're talking about without informing it. 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