Jump to content

Help with triggerServerEvent


xXMADEXx

Recommended Posts

For some reason the gate dosn't open o.O

server.lua

objct1 = createObject ( 980, -55, -95, 1013,0,0,90) 
setElementInterior(objct1,18) 
function gateOpen() 
    moveObject (objct1, 500, -55, -95, 1005) 
    playSoundFrontEnd(source, 1) 
    triggerEvent(source,"message:addMessage",source,"Jail: Moving Main Gate.",255, 255, 0) 
end 
addEvent("jail.gate.open",true) 
addEventHandler("jail.gate.open",gateOpen) 

client.lua

  
--Gate 
mrkr = createMarker( -54.1416015625, -91.8134765625, 1010.182800293, "cylinder", 8, 0, 255, 0, 80) 
setElementInterior(mrkr,18) 
  
window = guiCreateWindow(471,334,337,268,"Jail",false) 
guiSetAlpha(window,1) 
guiSetVisible(window,false) 
guiWindowSetMovable(window,false) 
guiWindowSetSizable(window,false) 
lbl = guiCreateLabel(9,28,316,109,"Open\nGate?",false,window) 
guiLabelSetColor(lbl,255,0,0) 
guiLabelSetHorizontalAlign(lbl,"center",false) 
guiSetFont(lbl,"sa-header") 
btn_accpt = guiCreateButton(9,198,157,61,"Yes",false,window) 
btn_close = guiCreateButton(167,198,157,61,"No",false,window) 
  
function onhit() 
    guiSetVisible(window,true) 
    showCursor(true) 
end 
addEventHandler("onClientMarkerHit",mrkr,onhit) 
  
function close() 
    guiSetVisible(window,false) 
    showCursor(false,false) 
end 
addEventHandler("onClientGUIClick",btn_close,close) 
  
function accept() 
    triggerServerEvent("jail.gate.open") 
    outputChatBox("Jail: Main gate opening...",255,255,0) 
    guiSetVisible(window,false) 
    showCursor(false,false) 
end 
addEventHandler("onClientGUIClick",btn_accpt,accept) 

Link to comment
  
--Gate 
mrkr = createMarker( -54.1416015625, -91.8134765625, 1010.182800293, "cylinder", 8, 0, 255, 0, 80) 
setElementInterior(mrkr,18) 
  
window = guiCreateWindow(471,334,337,268,"Jail",false) 
guiSetAlpha(window,1) 
guiSetVisible(window,false) 
guiWindowSetMovable(window,false) 
guiWindowSetSizable(window,false) 
lbl = guiCreateLabel(9,28,316,109,"Open\nGate?",false,window) 
guiLabelSetColor(lbl,255,0,0) 
guiLabelSetHorizontalAlign(lbl,"center",false) 
guiSetFont(lbl,"sa-header") 
btn_accpt = guiCreateButton(9,198,157,61,"Yes",false,window) 
btn_close = guiCreateButton(167,198,157,61,"No",false,window) 
  
function onhit() 
    guiSetVisible(window,true) 
    showCursor(true) 
end 
addEventHandler("onClientMarkerHit",mrkr,onhit) 
  
function close() 
    guiSetVisible(window,false) 
    showCursor(false,false) 
end 
addEventHandler("onClientGUIClick",btn_close,close) 
  
function accept() 
    triggerServerEvent("jail.gate.open",localPlayer,localPlayer) 
    outputChatBox("Jail: Main gate opening...",255,255,0) 
    guiSetVisible(window,false) 
    showCursor(false,false) 
end 
addEventHandler("onClientGUIClick",btn_accpt,accept) 

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