Jump to content

gui dupicate help


nasserdfdd

Recommended Posts

ok guys i fixed the last script then when i make copied the resource and made anthoer one and i change the cylender location and i hit the cylinder the both cylinder open and no error show in local server

this is the script

medic

server

GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(589, 389, 520, 321, "medic job", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1],false) 
        
        GUIEditor.button[1] = guiCreateButton(9, 32, 501, 107, "ACCEPT", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
        GUIEditor.button[2] = guiCreateButton(9, 204, 501, 107, "CLOSE", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000")     
    end 
) 
  
  
  
function showwindow() 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
end 
addEvent("showwin",true) 
addEventHandler("showwin", getRootElement(), showwindow) 
  
function closewindow() 
if source == GUIEditor.button[2] then 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end 
addEventHandler("onClientGUIClick", root, closewindow) 
  
  
  
function setpolice() 
    if source == GUIEditor.button[1] then 
        triggerServerEvent ("modPanel:setRole",localPlayer) 
    end 
end 
addEventHandler("onClientGUIClick", root, setpolice) 

client

    local marker = createMarker (  476.0654296875, -1765.6552734375, 14.117799758911, "cylinder", 1.5, 255, 255, 0, 170 ) 
      
    function openwindow(hitPlayer) 
    triggerClientEvent (hitPlayer,"showwin",getRootElement(),hitPlayer) 
    end 
    addEventHandler("onMarkerHit",marker,openwindow) 
      
      
    createTeam("Medic", 255, 0, 0) 
      
  
function Medic() 
    setElementData(client, "Role", "Medic") 
end 
addEvent("modPanel:setRole",true) 
addEventHandler("modPanel:setRole", root, Medic) 

police script is same but changed event hanndler

server

    local marker = createMarker (  500.0654296875, -1765.6552734375, 14.117799758911, "cylinder", 1.5, 255, 255, 0, 170 ) 
      
    function openwindow(hitPlayer) 
    triggerClientEvent (hitPlayer,"showwin",getRootElement(),hitPlayer) 
    end 
    addEventHandler("onMarkerHit",marker,openwindow) 
      
      
    createTeam("Police", 255, 0, 0) 
      
  
function Police() 
    setElementData(client, "Role", "Police officer") 
end 
addEvent("modPanels:setRolm",true) 
addEventHandler("modPanels:setRolm", root, Police) 

client

GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(589, 389, 520, 321, "policejob", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1],false) 
        
        GUIEditor.button[1] = guiCreateButton(9, 32, 501, 107, "ACCEPT", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
        GUIEditor.button[2] = guiCreateButton(9, 204, 501, 107, "CLOSE", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000")     
    end 
) 
  
  
  
function showwindow() 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
end 
addEvent("showwin",true) 
addEventHandler("showwin", getRootElement(), showwindow) 
  
function closewindow() 
if source == GUIEditor.button[2] then 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end 
addEventHandler("onClientGUIClick", root, closewindow) 
  
  
  
function setpolice() 
    if source == GUIEditor.button[1] then 
        triggerServerEvent ("modPanels:setRolm",localPlayer) 
    end 
end 
addEventHandler("onClientGUIClick", root, setpolice) 

edit:and if i stopped medic job the police jpb won't work but if i stopped police job medic job will be still working

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