TheIceman Posted April 15, 2012 Posted April 15, 2012 I made car spawn script and i cant spawn car who can help me? function openGUI() window = guiCreateWindow (0.3,0.2,0.3,0.6,"SACR Car spawn",true) gridlist = guiCreateGridList (0.1,0.1,0.8,0.7,true,window) column = guiGridListAddColumn( gridlist, "Vehicles:", 0.85 ) row = guiGridListAddRow ( gridlist ) guiGridListSetItemText ( gridlist, row, column, "Patriot", false, false ) button = guiCreateButton (0.8,0.8,0.2,0.2,"Patriot",true,window) close = guiCreateButton(0,0.85,0.45,0.1,"Close",true,window) showCursor (true) end addEvent ("openGUI",true) addEventHandler ("openGUI",getRootElement(getThisResource()),openGUI) function destroyGUI() destroyElement(window) window = false showCursor (false) end function buttonClick() if source == row then triggerServerEvent ("vehicle",getLocalPlayer()) destroyGUI () elseif source == close then destroyGUI () end end addEventHandler("onClientGUIClick",getRootElement(),buttonClick) Please help me!!
drk Posted April 15, 2012 Posted April 15, 2012 Yes, I need that. You said the car don't spawn. Where the part of vehicle spawn? Also, for fix that: Seems like we are obliged to fix your code lol
TheIceman Posted April 15, 2012 Author Posted April 15, 2012 If i will update server.lua then u have my script
drk Posted April 15, 2012 Posted April 15, 2012 Can't you just post the fucking script and learn for a proper english? Do you think I will steal scripts? Why I will steal scripts if I can make by my own lol
Castillo Posted April 15, 2012 Posted April 15, 2012 local vehicles = { "Patriot" } function openGUI ( ) window = guiCreateWindow (0.3,0.2,0.3,0.6,"SACR Car spawn",true) gridlist = guiCreateGridList (0.1,0.1,0.8,0.7,true,window) column = guiGridListAddColumn( gridlist, "Vehicles:", 0.85 ) for index, vehicle in ipairs ( vehicles ) do local row = guiGridListAddRow ( gridlist ) guiGridListSetItemText ( gridlist, row, column, tostring ( vehicle ), false, false ) end button = guiCreateButton (0.8,0.8,0.2,0.2,"Spawn",true,window) close = guiCreateButton(0,0.85,0.45,0.1,"Close",true,window) showCursor ( true ) end addEvent ( "openGUI", true ) addEventHandler ( "openGUI", root, openGUI ) function destroyGUI() destroyElement(window) showCursor (false) window = nil end function buttonClick ( ) if ( source == button ) then -- "row" is not a GUI element. local row, col = guiGridListGetSelectedItem ( gridlist ) -- Get the selected item from the grid list. if ( row and col and row ~= -1 and col ~= -1 ) then -- If he has a selected item. local vehicleName = guiGridListGetItemText ( gridlist, row, col ) -- Get the text of it. triggerServerEvent ( "vehicle", localPlayer, getVehicleModelFromName ( vehicleName ) ) -- Trigger the "vehicle" event with a vehicle model argument. destroyGUI () end elseif ( source == close ) then destroyGUI () end end addEventHandler ( "onClientGUIClick", getRootElement(), buttonClick )
drk Posted April 15, 2012 Posted April 15, 2012 So what? if he posts here, I'll reply here. I will not answer those "THINGS".
Smart. Posted April 15, 2012 Posted April 15, 2012 And, you should be using the lua tag in the future iceman.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now