Gtagasje Posted October 16, 2011 Share Posted October 16, 2011 I created a gui for a police job, and I might miss some functions. But that isn't my problem.. It keeps showing in debug unexpected symbol near ) on line 10. This is my script: Client: local dutyMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) function createCopGui ( hitElement, matchingDimension ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel,true ) end ) addEventHandler("onMarkerHit", dutyMarker, createCopGui , function () createCopGui ( hitElement ) ouputChatBox ("Please choose if you wanna be police.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end showCursor(true) guiSetInputEnabled(true) end ) function PoliceTeam(button,state) if button == "left" and state == "up" then setPlayerTeam ("Police") triggerServerEvent("PoliceTeam") -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end end end and server: function SetPlayerPolice( hitElement ) end addEvent("PoliceTeam",true) addEventHandler("PoliceTeam", root, SetPlayerPolice) I miss things like memo ect. but i'll try to add that later. Link to comment
Castillo Posted October 16, 2011 Share Posted October 16, 2011 local dutyMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) function createCopGui ( hitElement ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel,true ) end addEventHandler("onClientMarkerHit", dutyMarker, function (hitElement) if hitElement == localPlayer then createCopGui ( hitElement ) ouputChatBox ("Please choose if you wanna be police.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end showCursor(true) guiSetInputEnabled(true) end end ) function PoliceTeam(button,state) if button == "left" and state == "up" then setPlayerTeam ("Police") triggerServerEvent("PoliceTeam") -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end end end Link to comment
Gtagasje Posted October 16, 2011 Author Share Posted October 16, 2011 (edited) Now it shows expected near 'end'.. but atleast thx for wanting to help Edited October 16, 2011 by Guest Link to comment
Castillo Posted October 16, 2011 Share Posted October 16, 2011 What server? also, you used onMarkerHit on a client side script, if you use client side markers you must use onClientMarkerHit. Link to comment
Gtagasje Posted October 16, 2011 Author Share Posted October 16, 2011 Ah, thx, and I posted a server file, in case of needed.. but it keeps showing expected near end Link to comment
Gtagasje Posted October 16, 2011 Author Share Posted October 16, 2011 This time it's on line 78 Link to comment
BriGhtx3 Posted October 16, 2011 Share Posted October 16, 2011 function PoliceTeam(button,state) if button == "left" and state == "up" then setPlayerTeam ("Police") triggerServerEvent("PoliceTeam") -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end end --end You dont need the last end Link to comment
Castillo Posted October 16, 2011 Share Posted October 16, 2011 You're messing client and server functions. Link to comment
Zalmon Posted October 16, 2011 Share Posted October 16, 2011 Ah, thx, and I posted a server file, in case of needed.. but it keeps showing expected near end expected near end means you have too many ends btw. It won't fix the problem because you used server side functions in client side, but it will get you a little closer. Link to comment
Gtagasje Posted October 17, 2011 Author Share Posted October 17, 2011 Ok, this is my actual script now (It didn't show the error message, thx) but when I press the button Have_Job, it doesn't hide the gui. local dutyMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) function createCopGui ( hitElement ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel,true ) end addEventHandler("onClientMarkerHit", dutyMarker, function (hitElement) if hitElement == localPlayer then createCopGui ( hitElement ) if (PoliceGui ~= nil) then guiSetVisible(PoliceGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end end end ) function PoliceTeam(Have_Job,state) if button == "left" and state == "up" then setPlayerTeam ("Police") triggerServerEvent("PoliceTeam") guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) end end Link to comment
TAPL Posted October 17, 2011 Share Posted October 17, 2011 Client side local dutyMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) function createCopGui ( hitElement ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel,true ) end addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement == localPlayer then createCopGui ( hitElement ) if (PoliceGui ~= nil) then guiSetVisible(PoliceGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end end end ) function PoliceTeam(button,state) if (source == Have_Job) then triggerServerEvent("PoliceTeam",localPlayer) guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) elseif (source == Cancel) then guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) end end addEventHandler ("onClientGUIClick", root, PoliceTeam) Server Side function SetPlayerPolice() setPlayerTeam (source, getTeamFromName("Police")) end addEvent("PoliceTeam",true) addEventHandler("PoliceTeam", root, SetPlayerPolice) 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