Jump to content

Police team gui


Gtagasje

Recommended Posts

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
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
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
Ah, thx, and I posted a server file, in case of needed.. :P 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

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

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

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