AlphaMark Posted November 14, 2013 Posted November 14, 2013 Why wont this work, The error is: Bad argument @ 'triggerClientEvent' [Expected element at argument 2, got nill] function SweepEnter(theVehicle, seat, jacked) local id = getElementModel ( theVehicle ) if id == 574 then outputChatBox("You are now sweeping!", thePlayer, 255, 0, 0) triggerClientEvent("SweepRoute", thePlayer) end end
AlphaMark Posted November 14, 2013 Author Posted November 14, 2013 function SweepRoute() local currentIndex = 1 local route = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 }, } marker = createMarker ( unpack ( route [ currentIndex ] ) ) addEventHandler ( "onMarkerHit", root, function ( ) if ( source == marker ) then currentIndex = ( currentIndex + 1 ) destroyElement ( marker ) marker = nil marker = createMarker ( unpack ( route [ currentIndex ] ) ) end end ) end
AlphaMark Posted November 14, 2013 Author Posted November 14, 2013 function SweepRoute() local currentIndex = 1 local route = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 }, } marker = createMarker ( unpack ( route [ currentIndex ] ) ) addEventHandler ( "onMarkerHit", root, function ( ) if ( source == marker ) then currentIndex = ( currentIndex + 1 ) destroyElement ( marker ) marker = nil marker = createMarker ( unpack ( route [ currentIndex ] ) ) end end ) end
TAPL Posted November 14, 2013 Posted November 14, 2013 ^^ Is this client side or server side? And btw, i was asking what the event used with this code: And why you need the trigger. function SweepEnter(theVehicle, seat, jacked) local id = getElementModel ( theVehicle ) if id == 574 then outputChatBox("You are now sweeping!", thePlayer, 255, 0, 0) triggerClientEvent("SweepRoute", thePlayer) end end Probably it's source not thePlayer.
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