Jump to content

Car spawner GUI?


Jullul7000

Recommended Posts

Posted (edited)

If got this code:

 --[[The function below is the spawn window itself. 
If you have any previous experience with scripting, even HTML, some of this should make sense to you.--]] 
function openVehicleSpawnClient()  
  
local screenWidth, screenHeight = guiGetScreenSize() 
local windowWidth, windowHeight = 233, 104 
local left = screenWidth/2 - windowWidth/2 
local top = screenHeight/2 - windowHeight/2 
  
showCursor(true) 
  
vehSpawnWin = guiCreateWindow(left, top, windowWidth, windowHeight, "Vehicle Spawner", false) 
guiWindowSetSizable(vehSpawnWin, false) 
  
sampleLabel = guiCreateLabel(15, 25, 201, 20, "Sample Vehicle Spawner", false, vehSpawnWin) 
guiLabelSetHorizontalAlign(sampleLabel, "center", false) 
guiLabelSetVerticalAlign(sampleLabel, "center") 
  
-- The lineEdit is where you type the modelID you want to spawn. 
lineEdit = guiCreateEdit(12, 45, 211, 20, "", false, vehSpawnWin) 
guiEditSetMaxLength(lineEdit, 32767) 
  
-- After entering the modelID you wish to spawn, you press the button "Spawn Vehicle" 
-- The button triggers the next function we use: spawnVehicleClient 
spawnBtn = guiCreateButton(14, 75, 211, 23, "Spawn Vehicle", false, vehSpawnWin) 
addEventHandler("onClientGUIClick", spawnBtn, spawnVehicleClient, false)    
  
end 
addEvent("openVehicleSpawn",true) 
addEventHandler("openVehicleSpawn",localPlayer,openVehicleSpawnClient) 
  
  
  
--[[This function gets the modelID you entered in the window, checks if it exists,- 
- and if the model does exist, it will trigger a serverside event. 
If the vehicle does not exist, you will get a message with an error warning.--]] 
function spawnVehicleClient() 
  
local id = guiGetText(lineEdit) 
triggerServerEvent("spawnVehicleServer",localPlayer,id) 
showCursor(false) 
guiSetVisible(vehSpawnWin,false) 
  
end 

But i wanna add this GUI:

GUIEditor = { 
    radiobutton = {}, 
    button = {}, 
    label = {}, 
    window = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(251, 127, 144, 150, "Spawn Vehicle", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.73) 
  
        GUIEditor.label[1] = guiCreateLabel(34, 32, 88, 24, "", false, GUIEditor.window[1]) 
        GUIEditor.radiobutton[1] = guiCreateRadioButton(17, 36, 101, 22, "PizzaBoy", false, GUIEditor.window[1]) 
        guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) 
        GUIEditor.button[1] = guiCreateButton(19, 81, 107, 45, "Create", false, GUIEditor.window[1])     
    end 
) 

How can i do that?? IDK how to script.

Edited by Guest
Posted

Both of them are GUI, what are you trying to do?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
Both of them are GUI, what are you trying to do?

I try to make a blue marker where i can spawn cars

So you want to replace the GUI?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
Both of them are GUI, what are you trying to do?

I try to make a blue marker where i can spawn cars

So you want to replace the GUI?

Yes. Do you have skype?? I need a scripter for my server.. Pls.. Add me when you have julian.knoeperd :D If you wanna help you get Co-Owner

Posted
--[[The function below is the spawn window itself. 
If you have any previous experience with scripting, even HTML, some of this should make sense to you.--]] 
function openVehicleSpawnClient() 
  
local screenWidth, screenHeight = guiGetScreenSize() 
local windowWidth, windowHeight = 233, 104 
local left = screenWidth/2 - windowWidth/2 
local top = screenHeight/2 - windowHeight/2 
  
showCursor(true) 
  
vehSpawnWin = guiCreateWindow(251, 127, 144, 150, "Spawn Vehicle", false) 
guiWindowSetSizable(vehSpawnWin, false) 
guiSetAlpha(vehSpawnWin, 0.73) 
  
sampleLabel = guiCreateLabel(34, 32, 88, 24, "", false, vehSpawnWin) 
radiobutton = guiCreateRadioButton(17, 36, 101, 22, "PizzaBoy", false, vehSpawnWin) 
guiRadioButtonSetSelected(radiobutton, true) 
CreateButton = guiCreateButton(19, 81, 107, 45, "Create", false, vehSpawnWin)     
  
-- The lineEdit is where you type the modelID you want to spawn. 
lineEdit = guiCreateEdit(12, 45, 211, 20, "", false, vehSpawnWin) 
guiEditSetMaxLength(lineEdit, 32767) 
  
-- After entering the modelID you wish to spawn, you press the button "Spawn Vehicle" 
-- The button triggers the next function we use: spawnVehicleClient 
spawnBtn = guiCreateButton(14, 75, 211, 23, "Spawn Vehicle", false, vehSpawnWin) 
addEventHandler("onClientGUIClick", spawnBtn, spawnVehicleClient, false)   
  
end 
addEvent("openVehicleSpawn",true) 
addEventHandler("openVehicleSpawn",localPlayer,openVehicleSpawnClient) 
  
  
  
--[[This function gets the modelID you entered in the window, checks if it exists,- 
- and if the model does exist, it will trigger a serverside event. 
If the vehicle does not exist, you will get a message with an error warning.--]] 
function spawnVehicleClient() 
  
local id = guiGetText(lineEdit) 
triggerServerEvent("spawnVehicleServer",localPlayer,id) 
showCursor(false) 
guiSetVisible(vehSpawnWin,false) 
  
end 

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

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