Jump to content

Trigger Client Event Problem


Recommended Posts

Hey,

I added a trigger client event and its saying bad argument at triggerclient event.

Im not sure whats wrong

Heres my server (not all of it)

addEventHandler('onColShapeHit', Col, 
     function(hitElement, dim) 
         if getElementType(hitElement) == 'player' then 
           if getTeamName(getPlayerTeam(hitElement))=="Police" then 
            moveObject(Barrier, 1000, 1544.69, -1630.8, 13.3, 0, -90, 0) 
        triggerClientEvent ( player, "beep" ) 
           end 
         end 
    end 
) 

And my client

function beep ( ) 
    playSoundFrontEnd ( 5 ) 
end 
  

Whats wrong with it :?

Link to comment
addEventHandler('onColShapeHit', Col, 
     function(hitElement, dim) 
         if getElementType(hitElement) == 'player' then 
           if getTeamName(getPlayerTeam(hitElement))=="Police" then 
            moveObject(Barrier, 1000, 1544.69, -1630.8, 13.3, 0, -90, 0) 
        triggerClientEvent ( hitElement, "beep", hitElement ) 
           end 
         end 
    end 
) 

Link to comment

Well, maybe something else is wrong, and btw, why do you need a trigger for a function that it's also server side..?

addEventHandler('onColShapeHit', Col, 
     function(hitElement, dim) 
         if getElementType(hitElement) == "player" then 
           if getTeamName(getPlayerTeam(hitElement))=="Police" then 
            moveObject(Barrier, 1000, 1544.69, -1630.8, 13.3, 0, -90, 0) 
           playSoundFrontEnd (hitElement, 5) 
           end 
         end 
    end 
) 
  

Edited by Guest
Link to comment
playSoundFrontEnd(hitPlayer, 5) 

should be

playSoundFrontEnd(hitElement, 5) 

and before in your first code

function beep ( ) 
    playSoundFrontEnd ( 5 ) 
end 

did you add the event? like this?

function beep ( ) 
    playSoundFrontEnd ( 5 ) 
end 
addEvent("beep", true) 
addEventHandler("beep", root, beep) 

Edited by Guest
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...