HustraDev Posted August 18, 2014 Share Posted August 18, 2014 Hello All, i have been scripting a car show with a grid list spawner for the bought cars but when i use insert.table to insert values to spawn gridlist i Failed typing the code so i need some help right here code Server : addEvent ("createcar", true) addEventHandler ("createcar", getRootElement(), function(carID, carName, carPrice) --- if (getPlayerMoney (source) >= tonumber(carPrice)) then outputChatBox ("Bought a " .. carName, source, 255, 0, 0, false) outputChatBox ("ID: " .. carID, source, 255, 0, 0, false) outputChatBox ("Cost: " .. carPrice, source, 255, 0, 0, false) takePlayerMoney (source, tonumber (carPrice)) local x, y, z = getElementPosition ( source ) createVehicle ( carID, x, y + 5, z ) triggerClientEvent( source, 'table', source , carID, carName) else outputChatBox ("no money", source, 255, 0, 0, false) end end) Client : addEvent ( 'table', true) addEventHandler( 'table', localPlayer, function(carID, carName) table.insert(pcars,carID,carName) end ) Thanks Link to comment
xXMADEXx Posted August 18, 2014 Share Posted August 18, 2014 I think you were probably trying to get this: addEvent ( "table", true ) addEventHandler ( "table", root, function ( id, name ) if ( not pcars ) then pcars = { } end table.insert ( pcars, { id, name } ) end ) Link to comment
HustraDev Posted August 18, 2014 Author Share Posted August 18, 2014 I think you were probably trying to get this: addEvent ( "table", true ) addEventHandler ( "table", root, function ( id, name ) if ( not pcars ) then pcars = { } end table.insert ( pcars, { id, name } ) end ) i try it but nothing shows in gridlist Link to comment
HustraDev Posted August 18, 2014 Author Share Posted August 18, 2014 I think you were probably trying to get this: addEvent ( "table", true ) addEventHandler ( "table", root, function ( id, name ) if ( not pcars ) then pcars = { } end table.insert ( pcars, { id, name } ) end ) Fixed ~ Thanks 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