omarhossam Posted July 30, 2013 Share Posted July 30, 2013 i want to know How to attach a veh in a row in the gridlist?? function createGui () gui = guiCreateWindow( 300, 100, 265, 500, "Bike Rent Shop", false) guiSetInputEnabled ( false ) guiSetVisible(gui, false) guiWindowSetMovable( gui, false ) guiWindowSetSizable( gui, false ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, false, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn1 = guiCreateButton( 149, 430, 99, 45, "Leave", false, gui ) guiSetFont( btn1, "default-bold-small" ) List = guiCreateGridList ( 0.04, 0.05, 0.95, 0.75, true, gui ) column = guiGridListAddColumn( List, "Bikes", 0.85 ) btn2 = guiCreateButton(18,430,99,45,"Rent 50$",false, gui) guiSetProperty( btn1, "HoverTextColour", "FFFF0000" ) guiSetProperty( btn2, "HoverTextColour", "FFFFFF00" ) row = guiGridListAddRow (List) guiGridListSetItemText ( List, row, column, "Mountain Bike", false, false ) myItemData = guiGridListGetItemData (List, row, column ) row2 = guiGridListAddRow (List) guiGridListSetItemText (List, row2, column, "BMX", false, false ) row3 = guiGridListAddRow (List) guiGridListSetItemText (List, row3, column, "Bike", false, false ) addEventHandler("onClientGUIClick", btn1, close, false) addEventHandler("onClientGUIClick", btn2, rent, false) end Link to comment
omarhossam Posted July 30, 2013 Author Share Posted July 30, 2013 What do you mean? i meant to spawn a veh when i select the row and press the spawn button Link to comment
Castillo Posted July 30, 2013 Share Posted July 30, 2013 You must get the selected gridlist item using guiGridListGetSelectedItem, then you must get the item text using guiGridListGetItemText, and then you have to trigger a server side event using triggerServerEvent sending the vehicle name to the server side function ( which you have to make and add the event ), then on the server side you must get the vehicle model from it's name using getVehicleModelFromName and to finish, you get player's position and create the vehicle using createVehicle. Link to comment
omarhossam Posted July 30, 2013 Author Share Posted July 30, 2013 You must get the selected gridlist item using guiGridListGetSelectedItem, then you must get the item text using guiGridListGetItemText, and then you have to trigger a server side event using triggerServerEvent sending the vehicle name to the server side function ( which you have to make and add the event ), then on the server side you must get the vehicle model from it's name using getVehicleModelFromName and to finish, you get player's position and create the vehicle using createVehicle. HAHAHAHAAH, Anyway ty Link to comment
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