AlexWo Posted May 22, 2013 Share Posted May 22, 2013 Hi I started to script a PoliceJob, with Server and Client Side. At the Server Side I added a "triggerClientEvent" but my server.exe says: "WARNING: Policejob-server.lua:5: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil] Server Side: PoliceJobMarker = createMarker(1552.7, -1673.6, 16.2, "cylinder", 1.5, 0, 0, 255) function policejob (theMarker) if ( theMarker == PoliceJobMarker) then triggerClientEvent ( policejobwindow, source) end end addEventHandler ( "onPlayerMarkerHit", root, policejob ) Client Side: guiCreateLabel(0.02,0.04,0.94,0.2, "Press ACCEPT to work as Police Officer, press CANCEL to leave this window", true, PoliceJobChooseTab) function policejobwindow () PoliceJobWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Police Job", true ) PoliceJobTabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, PoliceJobWindow ) PoliceJobChooseTab = guiCreateTab ( "Accept/Cancel", PoliceJobTabPanel) guiCreateLabel(0.02,0.04,0.94,0.2, "Press ACCEPT to work as Police Officer, press CANCEL to leave this window", true, PoliceJobChooseTab) end addEventHandler( "onPlayerMarkerHit", root, policejobwindow ) Well I think I entered some false variables at the "triggerClientFunction" but I'm not sure. Thank you for helping Link to comment
iPrestege Posted May 22, 2013 Share Posted May 22, 2013 -- # Client Side ! addEventHandler("onClientResourceStart",resourceRoot, function ( ) guiCreateLabel(0.02,0.04,0.94,0.2, "Press ACCEPT to work as Police Officer, press CANCEL to leave this window", true, PoliceJobChooseTab) PoliceJobWindow = guiCreateWindow ( 0, 0, 0.5, 0.4, "Police Job", true ) guiSetVisible ( PoliceJobWindow,false ) PoliceJobTabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, PoliceJobWindow ) PoliceJobChooseTab = guiCreateTab ( "Accept/Cancel", PoliceJobTabPanel) guiCreateLabel(0.02,0.04,0.94,0.2, "Press ACCEPT to work as Police Officer, press CANCEL to leave this window", true, PoliceJobChooseTab) end ) addEvent("policejobwindow",true) addEventHandler("policejobwindow",root, function ( ) guiSetVisible ( PoliceJobWindow,true ) showCursor ( true ) end ) -- Server Side ! local PoliceJobMarker = createMarker(1552.7, -1673.6, 16.2, "cylinder", 1.5, 0, 0, 255) function policejob (theMarker) if ( theMarker == PoliceJobMarker) then triggerClientEvent ( source,"policejobwindow", source) end end addEventHandler ( "onPlayerMarkerHit", root, policejob ) Try it . Link to comment
AlexWo Posted May 22, 2013 Author Share Posted May 22, 2013 Hmmm.... Nothing happens... Link to comment
iPrestege Posted May 22, 2013 Share Posted May 22, 2013 I've tested it right now and everything fine . Link to comment
AlexWo Posted May 22, 2013 Author Share Posted May 22, 2013 Ok it works for me now either.... I just copied it a second time... Thank you Link to comment
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