Gtagasje Posted October 21, 2011 Share Posted October 21, 2011 Hello, I have made a gui for police team job, and I changed all the things which I though had to be changed to criminal. But now it shows this error : Bad Argument @ line 57, guiSetVisible expected gui element, got nil. This is my client script: local dutyMarker = createMarker ( 1229, -1423.6999511719, 13,'cylinder', 2.0, 225, 0, 0, 137 ) function createCrimGui ( hitElement ) CrimGui = guiCreateWindow(227,106,342,376,"MLAW Criminal job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,CrimGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,CrimGui) Doel = guiCreateMemo(63,44,234,242,"Criminal:\nAs Criminal you need to rob houses. You will get 0-1K from this.",false,CrimGui) guiMemoSetReadOnly( Doel,true ) end addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement == localPlayer then createCrimGui ( hitElement ) if (CrimGui ~= nil) then guiSetVisible(CrimGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("You aren't ready yet. Re-enter the marker.") end end end ) function CrimTeam (button,state) if (source == Have_Job) then triggerServerEvent("CrimTeam",localPlayer) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) elseif (source == Cancel) then guiSetInputEnabled(false) guiSetVisible( CrimGui, false ) showCursor(false) end end addEventHandler ("onClientGUIClick", root, CrimTeam) and server: local Criminal = createTeam ("Criminal", 255, 0, 0) function SetPlayerCrim() setPlayerTeam (source, getTeamFromName("Criminal")) end addEvent("CrimTeam",true) addEventHandler("CrimTeam", root, SetPlayerCrim) Link to comment
Gtagasje Posted October 21, 2011 Author Share Posted October 21, 2011 and it sets you to the police team ;s Link to comment
12p Posted October 21, 2011 Share Posted October 21, 2011 TIP: Don't double post. local dutyMarker = createMarker ( 1229, -1423.6999511719, 13,'cylinder', 2.0, 225, 0, 0, 137 ) CrimGui = guiCreateWindow(227,106,342,376,"MLAW Criminal job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,CrimGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,CrimGui) Doel = guiCreateMemo(63,44,234,242,"Criminal:\nAs Criminal you need to rob houses. You will get 0-1K from this.",false,CrimGui) guiMemoSetReadOnly( Doel,true ) guiSetVisible ( CrimGui, false ) addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement ~= localPlayer then exit end if CrimGui ~= nil then guiSetVisible(CrimGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("You aren't ready yet. Re-enter the marker.") end end ) addEventHandler ("onClientGUIClick", Have_Job, function ( ) triggerServerEvent("CrimTeam",localPlayer) showCursor(false) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) addEventHandler ("onClientGUIClick", Cancel, function ( ) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) Link to comment
Gtagasje Posted October 21, 2011 Author Share Posted October 21, 2011 It now shows = expected near end on line 28 ;s... Do you know what to do about this? Link to comment
Castillo Posted October 21, 2011 Share Posted October 21, 2011 local dutyMarker = createMarker ( 1229, -1423.6999511719, 13,'cylinder', 2.0, 225, 0, 0, 137 ) CrimGui = guiCreateWindow(227,106,342,376,"MLAW Criminal job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,CrimGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,CrimGui) Doel = guiCreateMemo(63,44,234,242,"Criminal:\nAs Criminal you need to rob houses. You will get 0-1K from this.",false,CrimGui) guiMemoSetReadOnly( Doel,true ) guiSetVisible ( CrimGui, false ) addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement ~= localPlayer then return end if CrimGui ~= nil then guiSetVisible(CrimGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("You aren't ready yet. Re-enter the marker.") end end ) addEventHandler ("onClientGUIClick", Have_Job, function ( ) triggerServerEvent("CrimTeam",localPlayer) showCursor(false) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) addEventHandler ("onClientGUIClick", Cancel, function ( ) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) Link to comment
Gtagasje Posted October 21, 2011 Author Share Posted October 21, 2011 Thank you very much again and again Casti! Link to comment
Gtagasje Posted October 22, 2011 Author Share Posted October 22, 2011 It now shows a error about the policegui again.. wrong syntax @ line 57.. and it worked without the criminal job gui. If i'm in the criminal marker, it sets you to the cops team. Police client : local dutyMarker = createMarker ( 1229, -1423.6999511719, 13,'cylinder', 2.0, 225, 0, 0, 137 ) CrimGui = guiCreateWindow(227,106,342,376,"MLAW Criminal job",false) Have_Job = guiCreateButton(39,313,111,45,"Have job!",false,CrimGui) Cancel = guiCreateButton(200,312,111,45,"Cancel",false,CrimGui) Doel = guiCreateMemo(63,44,234,242,"Criminal:\nAs Criminal you need to rob houses. You will get 0-1K from this.",false,CrimGui) guiMemoSetReadOnly( Doel,true ) guiSetVisible ( CrimGui, false ) addEventHandler("onClientMarkerHit", dutyMarker, function(hitElement) if hitElement ~= localPlayer then return end if CrimGui ~= nil then guiSetVisible(CrimGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("You aren't ready yet. Re-enter the marker.") end end ) addEventHandler ("onClientGUIClick", Have_Job, function ( ) triggerServerEvent("CrimTeam",localPlayer) showCursor(false) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) addEventHandler ("onClientGUIClick", Cancel, function ( ) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end, false ) and server: local Police = createTeam ("Police", 0, 0, 255) function SetPlayerPolice() setPlayerTeam (source, getTeamFromName("Police")) setElementModel (source, 280) end addEvent("PoliceTeam",true) addEventHandler("PoliceTeam", root, SetPlayerPolice) P.S. I don't wanna be that annoying player, but I don't know what to do about this.. Link to comment
TAPL Posted October 22, 2011 Share Posted October 22, 2011 Exactly what you want the script do? Please explain better Link to comment
Gtagasje Posted October 22, 2011 Author Share Posted October 22, 2011 I made with some good help a script about a gui, that sets you to a team, with only 1 team, it sets you to police, but with also criminal, the police gui has an error. And the criminal gui sets you to Police. Link to comment
TAPL Posted October 22, 2011 Share Posted October 22, 2011 -- Client Side -- local PoliceMarker = createMarker ( 1556.33, -1608.37, 13, 'cylinder', 2.0, 0, 0, 225, 132 ) local CriminalMarker = createMarker ( 1229, -1423.6999511719, 13,'cylinder', 2.0, 225, 0, 0, 137 ) PoliceGui = guiCreateWindow(227,106,342,376,"MLAW Police job",false) Have_Job1 = guiCreateButton(39,313,111,45,"Have job!",false,PoliceGui) Cancel1 = guiCreateButton(200,312,111,45,"Cancel",false,PoliceGui) Doel1 = guiCreateMemo(63,44,234,242,"Police Job:\nAs police you will have a hourly payment. Further objectves comming soon!",false,PoliceGui) guiMemoSetReadOnly( Doel1,true ) guiSetVisible(PoliceGui, false) CrimGui = guiCreateWindow(227,106,342,376,"MLAW Criminal job",false) Have_Job2 = guiCreateButton(39,313,111,45,"Have job!",false,CrimGui) Cancel2 = guiCreateButton(200,312,111,45,"Cancel",false,CrimGui) Doel2 = guiCreateMemo(63,44,234,242,"Criminal:\nAs Criminal you need to rob houses. You will get 0-1K from this.",false,CrimGui) guiMemoSetReadOnly( Doel2,true ) guiSetVisible(CrimGui, false) addEventHandler("onClientMarkerHit", PoliceMarker, function(hitElement) if hitElement == localPlayer then if (guiGetVisible(PoliceGui) == false) then guiSetVisible(PoliceGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("The police doesn't want you. Please re-enter the marker.") end end end ) addEventHandler("onClientMarkerHit", CriminalMarker, function(hitElement) if hitElement == localPlayer then if (guiGetVisible(CrimGui) == false) then guiSetVisible(CrimGui, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox ("You aren't ready yet. Re-enter the marker.") end end end ) function OnClick(button,state) if (source == Have_Job1) then triggerServerEvent("PoliceTeam",localPlayer) guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) elseif (source == Have_Job2) then triggerServerEvent("CrimTeam",localPlayer) guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) elseif (source == Cancel1) then guiSetInputEnabled(false) guiSetVisible(PoliceGui, false) showCursor(false) elseif (source == Cancel2) then guiSetInputEnabled(false) guiSetVisible(CrimGui, false) showCursor(false) end end addEventHandler ("onClientGUIClick", root, OnClick) -- Server Side -- local Police = createTeam ("Police", 0, 0, 255) local Criminal = createTeam ("Criminal", 255, 0, 0) function SetPlayerPolice() setPlayerTeam (source, getTeamFromName("Police")) end addEvent("PoliceTeam",true) addEventHandler("PoliceTeam", root, SetPlayerPolice) function SetPlayerCrim() setPlayerTeam (source, getTeamFromName("Criminal")) end addEvent("CrimTeam",true) addEventHandler("CrimTeam", root, SetPlayerCrim) 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