Jump to content

[HELP] Ammu-nation GUI


Recommended Posts

Hi there, I've made an ammunition script and i am having the following problems with it

1. When the resource starts or when i reconnect, the ammu-nation screen appears

2. I've added Jetpack in it which gives jetpack but i am confused that how will a script bind "removePlayerJetpack" when he presses "j" and how can i make it that if I've bought it already, i'll be able to remove it and get it again and again by pressing "j" until disconnect. so what will be the command, please help

Here are the required fields for my problem

client.lua

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(84, 10, 631, 553, "Zombie Apocalypse ~ Armas", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF00FF00") 
  
        GUIEditor.button[20] = guiCreateButton(468, 420, 140, 87, "Comprar Jetpack (Until Disconnect) \n $100000", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[20], "default-bold-small") 
        guiSetProperty(GUIEditor.button[20], "NormalTextColour", "FF00FF00")     
    end 
) 
    bindKey ( "F1", "down", 
        function ( ) 
            local state = ( not guiGetVisible (  GUIEditor.window[1] ) ) 
            guiSetVisible (  GUIEditor.window[1], state ) 
            showCursor ( state ) 
        end 
    ) 
  
function onGuiClick () 
if (source == GUIEditor.button[20]) then 
triggerServerEvent ("Jetpack", getLocalPlayer()) 
end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  
  

server.lua

  
  
function Jetpack() 
if getPlayerMoney(source) >= 100000 then 
         takePlayerMoney(source, 100000) 
         givePedJetPack(source) 
        outputChatBox("Usted ha comprado Jetpack $100000", source, 0, 255, 0) 
        else 
           outputChatBox("No tienes suficiente dinero para comprar este artículo", source, 255, 0, 0) 
end 
end 
addEvent("Jetpack", true) 
addEventHandler("Jetpack", getRootElement(), Jetpack) 
  

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