Jump to content

triggerClientEvent


BorderLine

Recommended Posts

Hi scripters

Well i was boring and im trying to put sound to my moveocbject

dont work

this is the script

clientside

  
fuction opendoor() 
playSound ( "door.mp3", false ) 
end 
  

serverside

  
addEventHandler ("onMarkerHit",markerBHZ, 
function (hitPlayer) 
 local account = getPlayerAccount(hitPlayer) 
 if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'BHZ' ) ) then 
  moveObject (puerta2,1000,742.4,-2442.5,14.39) 
triggerClientEvent ("opendoor",hitPlayer,opendoor) 
 else 
  outputChatBox ("Acceso denegado!",hitPlayer) 
  killPed (hitPlayer) 
 end 
end) 
  

debugscript 3 say

Server triggered clientside event opendoor, but event is not added client

what type of event i need add to fuction opendoor?

Link to comment

First, you wrote: "fuction" instead of "function", second you never added the event client side, and third, use this:

-- client side:

function opendoor() 
playSound ( "door.mp3", false ) 
end 
addEvent("opendoor",true) 
addEventHandler("opendoor",root,opendoor) 

-- server side:

addEventHandler ("onMarkerHit",markerBHZ, 
function (hitPlayer) 
 local account = getPlayerAccount(hitPlayer) 
 if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'BHZ' ) ) then 
  moveObject (puerta2,1000,742.4,-2442.5,14.39) 
  triggerClientEvent (hitPlayer,"opendoor",hitPlayer) 
 else 
  outputChatBox ("Acceso denegado!",hitPlayer) 
  killPed (hitPlayer) 
 end 
end) 

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