Jump to content

Trigger Client Event Problem


Recommended Posts

Posted

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 :?

Founder of SAUR - Founder/Owner of ARC RPG

Posted
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 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Does it work now?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)
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

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

Posted

Oh, my bad, I put hitPlayer but it was hitElement :oops:

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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