Jump to content

some evento or function for it


Recommended Posts

I done a gui for my server and I want if a map is Started , the GUI Can Open

it is my code

cl-side

GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2988,0.2633,0.4137,0.39,"GUI Shop Panel",true) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_TabPanel[1] = guiCreateTabPanel(11,23,311,174,false,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = guiCreateTab("Armas",GUIEditor_TabPanel[1]) 
GUIEditor_Grid[1] = guiCreateGridList(7,8,153,139,false,GUIEditor_Tab[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
columnA = guiGridListAddColumn(GUIEditor_Grid[1],"Armas",0.4) 
  
columnP = guiGridListAddColumn(GUIEditor_Grid[1],"$",0.4) 
  
row1 = guiGridListAddRow(GUIEditor_Grid[1]) 
row2 = guiGridListAddRow(GUIEditor_Grid[1]) 
row3 = guiGridListAddRow(GUIEditor_Grid[1]) 
row4 = guiGridListAddRow(GUIEditor_Grid[1]) 
row5 = guiGridListAddRow(GUIEditor_Grid[1]) 
GUIEditor_Button[1] = guiCreateButton(188,98,111,42,"Comprar",false,GUIEditor_Tab[1]) 
GUIEditor_Tab[2] = guiCreateTab("Autos",GUIEditor_TabPanel[1]) 
GUIEditor_Button[2] = guiCreateButton(85,59,75,30,"Repair",false,GUIEditor_Tab[2]) 
GUIEditor_Button[3] = guiCreateButton(168,59,75,30,"Nitro",false,GUIEditor_Tab[2]) 
GUIEditor_Tab[3] = guiCreateTab("Skills",GUIEditor_TabPanel[1]) 
GUIEditor_Label[1] = guiCreateLabel(165,201,157,27,"BaseMode Server By ElMota",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("F5","down",  
function() 
guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
showCursor(guiGetVisible(GUIEditor_Window[1])) 
end 
) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),  
function() 
guiGridListSetItemText(GUIEditor_Grid[1], row1, columnA, "M4", false, false) 
guiGridListSetItemText(GUIEditor_Grid[1], row2, columnP, "4000", false, false) 
end 
) 
  
addEventHandler ( 'onClientGUIClick', guiRoot, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            if ( row1 and columnA and row1 ~= -1 and colA ~= -1 ) then 
                triggerServerEvent("DarArmas", getLocalPlayer()) 
                guiSetVisible ( GUIEditor_Window[1], false ) 
                showCursor ( false ) 
                end 
            end 
        end 
    ) 

Im doing the Sv-side :lol:

Link to comment

try this:

addEvent("onMapStart",true) 
addEventHandler("onMapStart",root,function() 
    guiSetVisible(,true) 
    showCursor(true) 
    guiSetInputEnabled(true) 
end) 
addEventHandler("onClientResourceStart",resourceRoot,function() 
GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2988,0.2633,0.4137,0.39,"GUI Shop Panel",true) 
guiSetVisible(GUIEditor_Window[1],false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_TabPanel[1] = guiCreateTabPanel(11,23,311,174,false,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = guiCreateTab("Armas",GUIEditor_TabPanel[1]) 
GUIEditor_Grid[1] = guiCreateGridList(7,8,153,139,false,GUIEditor_Tab[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
columnA = guiGridListAddColumn(GUIEditor_Grid[1],"Armas",0.4) 
  
columnP = guiGridListAddColumn(GUIEditor_Grid[1],"$",0.4) 
  
row1 = guiGridListAddRow(GUIEditor_Grid[1]) 
row2 = guiGridListAddRow(GUIEditor_Grid[1]) 
row3 = guiGridListAddRow(GUIEditor_Grid[1]) 
row4 = guiGridListAddRow(GUIEditor_Grid[1]) 
row5 = guiGridListAddRow(GUIEditor_Grid[1]) 
GUIEditor_Button[1] = guiCreateButton(188,98,111,42,"Comprar",false,GUIEditor_Tab[1]) 
GUIEditor_Tab[2] = guiCreateTab("Autos",GUIEditor_TabPanel[1]) 
GUIEditor_Button[2] = guiCreateButton(85,59,75,30,"Repair",false,GUIEditor_Tab[2]) 
GUIEditor_Button[3] = guiCreateButton(168,59,75,30,"Nitro",false,GUIEditor_Tab[2]) 
GUIEditor_Tab[3] = guiCreateTab("Skills",GUIEditor_TabPanel[1]) 
GUIEditor_Label[1] = guiCreateLabel(165,201,157,27,"BaseMode Server By ElMota",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("F5","down", 
function() 
guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
showCursor(guiGetVisible(GUIEditor_Window[1])) 
end 
) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
function() 
guiGridListSetItemText(GUIEditor_Grid[1], row1, columnA, "M4", false, false) 
guiGridListSetItemText(GUIEditor_Grid[1], row2, columnP, "4000", false, false) 
end 
) 
  
addEventHandler ( 'onClientGUIClick', guiRoot, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            if ( row1 and columnA and row1 ~= -1 and colA ~= -1 ) then 
                triggerServerEvent("DarArmas", getLocalPlayer()) 
                guiSetVisible ( GUIEditor_Window[1], false ) 
                showCursor ( false ) 
                end 
            end 
        end 
    ) 
end) 

Server:

addEventHandler("onResourceStart",root,function(res) 
    if(getResourceInfo(res,"type")=="Map"or"map")then 
        triggerClientEvent("onMapStart",root) 
    end 
end) 

Edited by Guest
Link to comment
-ClientSide 
addEvent("onMapStart",true) 
addEventHandler("onMapStart",root,function() 
    guiSetVisible(,true) 
    showCursor(true) 
    guiSetInputEnabled(true) 
end) 
addEventHandler("onClientResourceStart",resourceRoot,function() 
GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2988,0.2633,0.4137,0.39,"GUI Shop Panel",true) 
guiSetVisible(GUIEditor_Window[1],false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_TabPanel[1] = guiCreateTabPanel(11,23,311,174,false,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = guiCreateTab("Armas",GUIEditor_TabPanel[1]) 
GUIEditor_Grid[1] = guiCreateGridList(7,8,153,139,false,GUIEditor_Tab[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
columnA = guiGridListAddColumn(GUIEditor_Grid[1],"Armas",0.4) 
  
columnP = guiGridListAddColumn(GUIEditor_Grid[1],"$",0.4) 
  
row1 = guiGridListAddRow(GUIEditor_Grid[1]) 
row2 = guiGridListAddRow(GUIEditor_Grid[1]) 
row3 = guiGridListAddRow(GUIEditor_Grid[1]) 
row4 = guiGridListAddRow(GUIEditor_Grid[1]) 
row5 = guiGridListAddRow(GUIEditor_Grid[1]) 
GUIEditor_Button[1] = guiCreateButton(188,98,111,42,"Comprar",false,GUIEditor_Tab[1]) 
GUIEditor_Tab[2] = guiCreateTab("Autos",GUIEditor_TabPanel[1]) 
GUIEditor_Button[2] = guiCreateButton(85,59,75,30,"Repair",false,GUIEditor_Tab[2]) 
GUIEditor_Button[3] = guiCreateButton(168,59,75,30,"Nitro",false,GUIEditor_Tab[2]) 
GUIEditor_Tab[3] = guiCreateTab("Skills",GUIEditor_TabPanel[1]) 
GUIEditor_Label[1] = guiCreateLabel(165,201,157,27,"BaseMode Server By ElMota",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
  
guiSetVisible(GUIEditor_Window[1],false) 
showCursor(false) 
  
bindKey("F5","down", 
function() 
guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) 
showCursor(guiGetVisible(GUIEditor_Window[1])) 
end 
) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
function() 
guiGridListSetItemText(GUIEditor_Grid[1], row1, columnA, "M4", false, false) 
guiGridListSetItemText(GUIEditor_Grid[1], row2, columnP, "4000", false, false) 
end 
) 
  
addEventHandler ( 'onClientGUIClick', guiRoot, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            if ( row1 and columnA and row1 ~= -1 and colA ~= -1 ) then 
                triggerServerEvent("DarArmas", getLocalPlayer()) 
                guiSetVisible ( GUIEditor_Window[1], false ) 
                showCursor ( false ) 
                end 
            end 
        end 
    ) 
end) 
  
--servrSide 
  
  
addEventHandler("onResourceStart",root,function(res) 
    if(getResourceInfo(res,"type")=="Map"or"map")then 
        triggerClientEvent("onMapStart",root) 
    end 
end) 

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