xXMADEXx Posted April 7, 2013 Share 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) Link to comment
xXMADEXx Posted April 7, 2013 Author Share 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}}") Link to comment
PaiN^ Posted April 7, 2013 Share 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 .. Link to comment
xXMADEXx Posted April 7, 2013 Author Share 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? Link to comment
DNL291 Posted April 7, 2013 Share 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. Link to comment
xXMADEXx Posted April 7, 2013 Author Share 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? Link to comment
DNL291 Posted April 7, 2013 Share 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. Link to comment
DiSaMe Posted April 7, 2013 Share Posted April 7, 2013 If cars table is {{411}, {412}}, then v will be {411} and {412} and getVehicleNameFromModel only accepts numbers, not tables. Link to comment
Castillo Posted April 7, 2013 Share 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... } } Link to comment
xXMADEXx Posted April 7, 2013 Author Share 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. 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