Norhy Posted January 22, 2013 Posted January 22, 2013 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?
Baseplate Posted January 22, 2013 Posted January 22, 2013 Show how you did you trigger it. (server-side)
Norhy Posted January 22, 2013 Author Posted January 22, 2013 This is my server-side: function showMenu ( ) triggerClientEvent ( source, "ShowAmmu", source ) end addEventHandler ( "onMarkerHit", ammuSell, showMenu, false )
Baseplate Posted January 22, 2013 Posted January 22, 2013 function showMenu (thePlayer) triggerClientEvent ( thePlayer, "ShowAmmu" ) end addEventHandler ( "onMarkerHit", ammuSell, showMenu ) Source in onMarkerHit is the marker itself
Norhy Posted January 22, 2013 Author Posted January 22, 2013 WARNING: Bad Argument @ 'triggerClientEvent' [Expected element at argument 3, got none ]. I think that it was not needed to remove the argument, however your and mine codes, both don't work
Baseplate Posted January 22, 2013 Posted January 22, 2013 function showMenu (thePlayer) triggerClientEvent ( thePlayer, "ShowAmmu", getRootElement() ) end addEventHandler ( "onMarkerHit", ammuSell, showMenu )
Smart. Posted January 22, 2013 Posted January 22, 2013 function showMenu (thePlayer) triggerClientEvent ( thePlayer, "ShowAmmu", getRootElement() ) end addEventHandler ( "onMarkerHit", ammuSell, showMenu ) Why send to every player?
Ab-47 Posted January 22, 2013 Posted January 22, 2013 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 )
TAPL Posted January 22, 2013 Posted January 22, 2013 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now