xXMADEXx Posted April 7, 2013 Posted April 7, 2013 For some reason, its saying that @ line 5 (client) ( local name = getVehicleNameFromModel(v) ) that "V" is a bad argument - Server function addGroupSpawner(pos,cars,color) x,y,z,rotz = unpack(pos) local r,g,b = unpack (color) marker = createMarker(x, y, z - 1, "cylinder", 2, r, g, b, 150) addEventHandler("onMarkerHit",marker, function (p) triggerClientEvent(p,"showGroupVehicleSpawners",p,cars) end ) end addGroupSpawner({1319.1091308594, -2584.6645507813, 13.5390625}, {{411}, {412}}, {120, 0, 255}) ----------------------- -- Unfinsihed ----------------------- vehicle = {} function onCreateGroupVehicle(id) if (id) then vehicle[source] = createVehicle(id, x, y, z, rotz) end end addEvent("onCreateGroupVehicle",true) addEventHandler("onCreateGroupVehicle",root,onCreateGroupVehicle) - Bugged client area function showGroupVehicleSpawners(cars) guiSetVisible(window['groups'],true) showCursor(true) for i,v in ipairs (cars) do local name = getVehicleNameFromModel(v) row = guiGridListAddRow(gridlist['groups']) guiGridListSetItemText(gridlist['groups'], row, 1, name, false, false) guiGridListSetItemData(gridlist['groups'], row, 1, v) end end addEvent("showGroupVehicleSpawners",true) addEventHandler("showGroupVehicleSpawners",root,showGroupVehicleSpawners)
xXMADEXx Posted April 7, 2013 Author Posted April 7, 2013 Where is "cars" define? on srever side: addGroupSpawner({1319.1091308594, -2584.6645507813, 13.5390625}, {{411}, {412}}, {120, 0, 255}) (the "{{411}, {412}}")
PaiN^ Posted April 7, 2013 Posted April 7, 2013 Well it's obviously gona give you Bad Arg, Because ipairs loops all the table, And when you try to get the id from that table it won't work, because you'll get some wrong car IDs ..
xXMADEXx Posted April 7, 2013 Author Posted April 7, 2013 Well it's obviously gona give you Bad Arg, Because ipairs loops all the table, And when you try to get the id from that table it won't work, because you'll get some wrong car IDs .. so, how exacly do i fix this?
DNL291 Posted April 7, 2013 Posted April 7, 2013 Well it's obviously gona give you Bad Arg, Because ipairs loops all the table, And when you try to get the id from that table it won't work, because you'll get some wrong car IDs .. so, how exacly do i fix this? Use pairs instead.
xXMADEXx Posted April 7, 2013 Author Posted April 7, 2013 Well it's obviously gona give you Bad Arg, Because ipairs loops all the table, And when you try to get the id from that table it won't work, because you'll get some wrong car IDs .. so, how exacly do i fix this? Use pairs instead. I already tried that, and can someone tell me the differance between pairs and ipairs?
DNL291 Posted April 7, 2013 Posted April 7, 2013 I already tried that, and can someone tell me the differance between pairs and ipairs? See this topic: viewtopic.php?f=91&t=54461&hilit=between+ipairs Edit: Your table may be wrong.
DiSaMe Posted April 7, 2013 Posted April 7, 2013 If cars table is {{411}, {412}}, then v will be {411} and {412} and getVehicleNameFromModel only accepts numbers, not tables.
Castillo Posted April 7, 2013 Posted April 7, 2013 Your table has to be like this: myTable = { item1, item2, item3, etc... } And yours is like this: myTable = { { item1 }, { item2 }, { item3 }, { etc... } }
xXMADEXx Posted April 7, 2013 Author Posted April 7, 2013 Your table has to be like this: myTable = { item1, item2, item3, etc... } And yours is like this: myTable = { { item1 }, { item2 }, { item3 }, { etc... } } Thank you castillo. Please lock topic, i solved it.
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