Jump to content

[Help]Lua:Gui


JasperRieken

Recommended Posts

Well the GUI comes up when you fly verry high over it so thats weird and the marker is small

ClientSide

local marker7 = createMarker(2287.3046875,-3014.7346191406,53.385776519775,"cylinder",1.5,255,255,255,255) 
  
function gui7(hitElement) 
          if getElementType( hitElement ) == "player" and hitElement == getLocalPlayer() then 
           if ( guiGetVisible (window) == true ) then -- check if the gui element is visible      
                showCursor(false)           
                guiSetVisible (window, false ) -- if it is, we hide it 
        else               
                guiSetVisible (window, false ) -- if not, we make it visible 
                showCursor(true) 
                end 
  
window = guiCreateWindow(532,268,249,340,"Admin Spawn",false) 
but1 = guiCreateButton(21,30,206,48,"Hydra",false,window) 
addEventHandler("onClientGUIClick", but1,hydraPlane, false) 
but2 = guiCreateButton(21,89,206,48,"Hunter",false,window) 
addEventHandler("onClientGUIClick", but2,hunterPlane, false) 
but3 = guiCreateButton(19,148,206,48,"RC Baron",false,window) 
addEventHandler("onClientGUIClick", but3,rcPlane, false) 
but4 = guiCreateButton(20,207,206,48,"SeaSparrow",false,window) 
addEventHandler("onClientGUIClick", but4,seaPlane, false) 
but5 = guiCreateButton(59,277,126,25,"Close",false,window) 
addEventHandler("onClientGUIClick", but5, hideWindow, false) 
end 
end 
addEventHandler("onClientMarkerHit", marker7, gui7) 
  
function hydraPlane() 
guiSetVisible(window, false) 
showCursor(false) 
triggerServerEvent( "spawnHydra", getLocalPlayer(),getPlayerName( getLocalPlayer() ) ) 
end 
  
function hunterPlane() 
guiSetVisible(window, false) 
showCursor(false) 
triggerServerEvent( "spawnHunter", getLocalPlayer(),getPlayerName( getLocalPlayer() ) ) 
end 
  
function rcPlane() 
guiSetVisible(window, false) 
showCursor(false) 
triggerServerEvent( "spawnRc", getLocalPlayer(),getPlayerName( getLocalPlayer() ) ) 
end 
  
function seaPlane() 
guiSetVisible(window, false) 
showCursor(false) 
triggerServerEvent( "spawnSea", getLocalPlayer(),getPlayerName( getLocalPlayer() ) ) 
end 
  
function hideWindow() 
guiSetVisible(window, false) 
showCursor(false) 
end 

ServerSide

addEvent("spawnHydra", true)   
function adminQ(playerName) 
local guy = getPlayerFromName( playerName ); 
        local x, y, z = getElementPosition ( guy ) 
        local r = getPedRotation ( guy ) 
        vehicle = createVehicle ( 520, x, y, z, 0, 0, r ) 
        warpPedIntoVehicle ( guy, vehicle ) 
        outputChatBox("Hydra spawned!", guy, 0, 255, 0) 
        end 
        addEventHandler ( "spawnHydra", getRootElement(), adminQ ) 
         
addEvent("spawnHunter", true)   
function adminQ(playerName) 
local guy = getPlayerFromName( playerName ); 
        local x, y, z = getElementPosition ( guy ) 
        local r = getPedRotation ( guy ) 
        vehicle = createVehicle ( 425, x, y, z, 0, 0, r ) 
        warpPedIntoVehicle ( guy, vehicle ) 
        outputChatBox("Hunter spawned!", guy, 0, 255, 0) 
        end 
        addEventHandler ( "spawnHunter", getRootElement(), adminQ ) 
         
addEvent("spawnRc", true)   
function adminQ(playerName) 
local guy = getPlayerFromName( playerName ); 
        local x, y, z = getElementPosition ( guy ) 
        local r = getPedRotation ( guy ) 
        vehicle = createVehicle ( 464, x, y, z, 0, 0, r ) 
        warpPedIntoVehicle ( guy, vehicle ) 
        outputChatBox("Rc Baron spawned!", guy, 0, 255, 0) 
        end 
        addEventHandler ( "spawnRc", getRootElement(), adminQ ) 
         
addEvent("spawnSea", true)   
function adminQ(playerName) 
local guy = getPlayerFromName( playerName ); 
        local x, y, z = getElementPosition ( guy ) 
        local r = getPedRotation ( guy ) 
        vehicle = createVehicle ( 447, x, y, z, 0, 0, r ) 
        warpPedIntoVehicle ( guy, vehicle ) 
        outputChatBox("Seasparrow spawned!", guy, 0, 255, 0) 
        end 
        addEventHandler ( "spawnSea", getRootElement(), adminQ ) 

Edited by Guest
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...