Jump to content

Error


AlphaMark

Recommended Posts

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 

Link to comment
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 

Link to comment
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 

Link to comment

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

Link to comment

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