Jump to content

triggerClientEvent again..


Norhy

Recommended Posts

wdwMenu = guiCreateWindow( 0.150, 0.150, 0.70, 0.70, "Ammunation", true ) 
  
guiSetVisible ( wdwMenu, false ) 
showCursor ( false ) 
  
function ShowTheMenu ( ) 
    guiSetVisible ( wdwMenu, true ) 
    showCursor ( true ) 
end 
addEvent ( "ShowAmmu", true ) 
addEventHandler ( "ShowAmmu", getRootElement (), ShowTheMenu ) 

When i enter the menu marker, nothing happens. I had a error but fixed it, still nothing happens. No errors and warnings, something's wrong?

Link to comment

Server-

function showMenu ( thePlayer ) 
    triggerClientEvent ( "ShowAmmu", thePlayer ) 
end 
addEventHandler ( "onMarkerHit", ammuSell, showMenu ) 

Client-

wdwMenu = guiCreateWindow( 0.150, 0.150, 0.70, 0.70, "Ammunation", true ) 
  
guiSetVisible ( wdwMenu, false ) 
showCursor ( false ) 
  
function ShowTheMenu ( ) 
    guiSetVisible ( wdwMenu, true ) 
    showCursor ( true ) 
end 
addEvent ( "ShowAmmu", true ) 
addEventHandler ( "ShowAmmu", getRootElement (), ShowTheMenu ) 

Link to comment
This is my server-side:
function showMenu ( ) 
    triggerClientEvent ( source, "ShowAmmu", source ) 
end 
addEventHandler ( "onMarkerHit", ammuSell, showMenu, false ) 

function showMenu(hitElement) 
    if getElementType(hitElement) == "player" then 
        triggerClientEvent(hitElement, "ShowAmmu", hitElement) 
    end 
end 
addEventHandler("onMarkerHit", ammuSell, showMenu) 

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