PARKAH Posted August 7, 2013 Posted August 7, 2013 marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function() local vh = getPedOccupiedVehicle ( source ) vehicles = {462} nm = tonumber ( math.random( #vehicles ) ) setElementModel ( vh, nm ) end)
Baseplate Posted August 7, 2013 Posted August 7, 2013 marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function(hitElement) local vh = getPedOccupiedVehicle (hitElement) vehicles = {462} nm = tonumber ( math.random( #vehicles ) ) setElementModel ( vh, nm ) end) The source of onClientMarkerHit is the maker itself, use hitElement instead.
WASSIm. Posted August 7, 2013 Posted August 7, 2013 trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } local marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function(thePlayer) local vh = getPedOccupiedVehicle (thePlayer) nm = math.random(400,602 ) if (nm ~= trailers) then setElementModel ( vh, nm ) end end)
xXMADEXx Posted August 7, 2013 Posted August 7, 2013 trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } local marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function(thePlayer) local vh = getPedOccupiedVehicle (thePlayer) nm = math.random(400,602 ) if (nm ~= trailers) then setElementModel ( vh, nm ) end end) Huh? @PARKAH - Do you have a "vehicles" table defined? The Ultimate Lua Tutorial! | MTA PHP SDK
manve1 Posted August 7, 2013 Posted August 7, 2013 xXMADEXx, he does. marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function() local vh = getPedOccupiedVehicle ( source ) vehicles = {462} -- RIGHT HERE HE DOES. nm = tonumber ( math.random( #vehicles ) ) setElementModel ( vh, nm ) end) Looking for tutorials or information? check out: www.simpleask.co.uk
xXMADEXx Posted August 7, 2013 Posted August 7, 2013 xXMADEXx, he does. marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function() local vh = getPedOccupiedVehicle ( source ) vehicles = {462} -- RIGHT HERE HE DOES. nm = tonumber ( math.random( #vehicles ) ) setElementModel ( vh, nm ) end) Oh, my bad. I didn't see that. ((Not Tested)) marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function( p ) local vh = getPedOccupiedVehicle ( p ) vehicles = {462} nm = tonumber ( vehicles [ math.random( #vehicles ) ] ) setElementModel ( vh, nm ) end) The Ultimate Lua Tutorial! | MTA PHP SDK
iMr.3a[Z]eF Posted August 7, 2013 Posted August 7, 2013 Use localPlayer instead p or source marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) addEventHandler("onClientMarkerHit",marker, function ( ) local vh = getPedOccupiedVehicle ( localPlayer ) if getElementModel(vh) == 462 then local nm = tonumber ( vehicles [ math.random( #vehicles ) ] ) setElementModel ( vh, nm ) end end) To Visit Us Press Here: mtasa://5.9.206.180:22002
denny199 Posted August 7, 2013 Posted August 7, 2013 You guys are all failing.. For vehicle id's you can look right here: https://wiki.multitheftauto.com/wiki/Vehicle_IDs local vehiclesTable = {429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503} marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) function markerHit(hitElement) if hitElement == localPlayer then local vh = getPedOccupiedVehicle ( hitElement ) local nm = tonumber (1,math.random( #vehiclesTable ) ) setElementModel ( vh, nm ) end end addEventHandler("onClientMarkerHit",marker,markerHit ) Tip: Also aligain the vehicle posZ one cordinate up for preventing the cars to get stuck into the ground. Sometimes I dream about cheese
PARKAH Posted August 8, 2013 Author Posted August 8, 2013 @denny I only want it to spawn in one vehicle, so you're failing.
denny199 Posted August 8, 2013 Posted August 8, 2013 Whythehex are you using a table then, maybe because you got it from a another topic? So please, tell us why are you using usseless tables, since i tought, a table with one vehicleID, so weird. marker = createMarker(1949, -1705, 13,"corona",2,0,255,0) function markerHit(hitElement) if hitElement == localPlayer then local vh = getPedOccupiedVehicle ( hitElement ) setElementModel ( vh, 462) end end addEventHandler("onClientMarkerHit",marker,markerHit ) Sometimes I dream about cheese
TAPL Posted August 8, 2013 Posted August 8, 2013 setElementModel client side won't change the model for everyone, so that you know.
PARKAH Posted August 8, 2013 Author Posted August 8, 2013 I got it from a tutorial topic, but none of those are working
denny199 Posted August 8, 2013 Posted August 8, 2013 Show us your meta... Sometimes I dream about cheese
PARKAH Posted August 8, 2013 Author Posted August 8, 2013 The skin doesn't matter because it loads fine just doesn't work, it loads a green glow but it doesn't do anything.
xXMADEXx Posted August 10, 2013 Posted August 10, 2013 use attachElements? The Ultimate Lua Tutorial! | MTA PHP SDK
denny199 Posted August 10, 2013 Posted August 10, 2013 Show us your meta.xml... ... Sometimes I dream about cheese
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