Jump to content

[SCRIPT]Problem


Recommended Posts

i got a problem With this script it is Client Side the problem is when Someone is on the marker it shows the panel for everybody

Client:

addEventHandler("onClientMarkerHit", resourceRoot, 
    function() 
        panel = guiCreateWindow(363, 122, 640, 424, "Drug Dealers", false) 
        guiWindowSetSizable(panel, false) 
  
        informacion = guiCreateMemo(19, 26, 602, 329, "It is a criminal Job that Gives you Some rights like Sell Drugs, Rob Stores and More things If you want to accept this job you must Press Accept If you don't Want to accept this job Press Cancel.", false, panel) 
        aceptar = guiCreateButton(19, 363, 220, 51, "Accept", false, panel) 
        guiSetFont(aceptar, "default-bold-small") 
        cerrar = guiCreateButton(401, 363, 220, 51, "Cancel", false, panel) 
        guiSetFont(cerrar, "default-bold-small")     
         
        showCursor(true) 
        addEventHandler ("onClientGUIClick", aceptar, aceptarr, false ) 
        addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) 
    end 
) 
  
function aceptarr() 
showCursor (false) 
guiSetVisible ( panel, not guiGetVisible ( panel ) ) 
end 
addEventHandler( "onClientGUIClick",aceptarr, true ) 
  
function cerrarr() 
showCursor (false) 
guiSetVisible (panel, not guiGetVisible ( panel ) ) 
end 
addEventHandler ("onClientGUIClick", cerrarr, true) 
  

Server:

function crear() 
local ped1 = createPed ( 28, 1617.45349, -1509.32239, 13.60826, 90 ) 
setPedArmor ( ped1, 100 ) 
setPedFrozen ( ped1, true ) 
end 
addEventHandler("onResourceStart", getRootElement(), crear) 
  
function crearmarker() 
marcador = createMarker ( 1616.75659, -1509.40015, 12.500, "cylinder", 1.0, 255, 0, 0, 100 ) 
end 
addEventHandler("onResourceStart", getRootElement(), crearmarker ) 

 

Link to comment

You must check if the element that hit the marker is the local player.

addEventHandler("onClientMarkerHit", resourceRoot, 
    function ( hitElement ) 
        if ( hitElement == localPlayer ) then -- Here. 
            panel = guiCreateWindow(363, 122, 640, 424, "Drug Dealers", false) 
            guiWindowSetSizable(panel, false) 
  
            informacion = guiCreateMemo(19, 26, 602, 329, "It is a criminal Job that Gives you Some rights like Sell Drugs, Rob Stores and More things If you want to accept this job you must Press Accept If you don't Want to accept this job Press Cancel.", false, panel) 
            aceptar = guiCreateButton(19, 363, 220, 51, "Accept", false, panel) 
            guiSetFont(aceptar, "default-bold-small") 
            cerrar = guiCreateButton(401, 363, 220, 51, "Cancel", false, panel) 
            guiSetFont(cerrar, "default-bold-small")     
        
            showCursor(true) 
            addEventHandler ("onClientGUIClick", aceptar, aceptarr, false ) 
            addEventHandler ("onClientGUIClick", cerrar, cerrarr, false ) 
        end 
    end 
) 
  
function aceptarr() 
showCursor (false) 
guiSetVisible ( panel, not guiGetVisible ( panel ) ) 
end 
addEventHandler( "onClientGUIClick",aceptarr, true ) 
  
function cerrarr() 
showCursor (false) 
guiSetVisible (panel, not guiGetVisible ( panel ) ) 
end 
addEventHandler ("onClientGUIClick", cerrarr, true) 

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