brunob22 Posted May 31, 2015 Share Posted May 31, 2015 tenho o seguinte erro Bad argument @ 'destroyElement' [Expected element at argument 1, got string 'Bobcat'] client side: elseif(source == deletarcarro) then local deletarcarro1 = guiGridListGetItemText(carrolista, guiGridListGetSelectedItem(carrolista), 1) triggerServerEvent( "b2.deletarcarro",localPlayer, deletarcarro1) server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) and deletarcarro1 then destroyElement( deletarcarro1 ) end end) the function and delete the generated car gridlist sorry bad ingles =( Link to comment
ALw7sH Posted May 31, 2015 Share Posted May 31, 2015 What you are trying to do is removing the text on the girdlist and it's not being deleted because element created on client-side can't be deleted from server-side If you want to delete vehicle set the vehicle as data to the row using guiGridListSetItemData Link to comment
brunob22 Posted May 31, 2015 Author Share Posted May 31, 2015 What you are trying to do is removing the text on the girdlist and it's not being deleted because element created on client-sidecan't be deleted from server-side If you want to delete vehicle set the vehicle as data to the row using guiGridListSetItemData I do not want to delete the text, but the car he generate the gridlist Link to comment
Walid Posted June 1, 2015 Share Posted June 1, 2015 help?? Explain your problem better , you can't destroy a string; vehicle it's an element -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then destroyElement(v) end end end end end ) Link to comment
brunob22 Posted June 1, 2015 Author Share Posted June 1, 2015 help?? Explain your problem better , you can't destroy a string; vehicle it's an element -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then destroyElement(v) end end end end end ) nice code.. your coding delete all car with the same name is not the only one Link to comment
neves768 Posted June 1, 2015 Share Posted June 1, 2015 -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPositin(v) if x == tonumber(xx) and y == tonumber(yy) and z == tonumber(zz) then -- Here's only 1 vehicle or more if have 2 (or more) vehicles at the same coordinates destroyElement(v) end end end end end end) Use it with a trigger and for xx,yy and zz use the X,Y and Z columns. Link to comment
xeon17 Posted June 1, 2015 Share Posted June 1, 2015 -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPositin(v) if x == tonumber(xx) and y == tonumber(yy) and z == tonumber(zz) then -- Here's only 1 vehicle or more if have 2 (or more) vehicles at the same coordinates destroyElement(v) end end end end end end) Use it with a trigger and for xx,yy and zz use the X,Y and Z columns. You got a type on line 9 , friend. Link to comment
brunob22 Posted June 2, 2015 Author Share Posted June 2, 2015 -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPositin(v) if x == tonumber(xx) and y == tonumber(yy) and z == tonumber(zz) then -- Here's only 1 vehicle or more if have 2 (or more) vehicles at the same coordinates destroyElement(v) end end end end end end) Use it with a trigger and for xx,yy and zz use the X,Y and Z columns. you code dont work. no erro. change code.. addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPosition( v ) if x == tonumber(xx) or y == tonumber(yy) or z == tonumber(zz) then destroyElement(v) end end end end end end) punch it only deletes if you have one car on spawn Link to comment
neves768 Posted June 2, 2015 Share Posted June 2, 2015 -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPositin(v) if x == tonumber(xx) and y == tonumber(yy) and z == tonumber(zz) then -- Here's only 1 vehicle or more if have 2 (or more) vehicles at the same coordinates destroyElement(v) end end end end end end) Use it with a trigger and for xx,yy and zz use the X,Y and Z columns. you code dont work. no erro. change code.. addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPosition( v ) if x == tonumber(xx) or y == tonumber(yy) or z == tonumber(zz) then destroyElement(v) end end end end end end) punch it only deletes if you have one car on spawn But, this is not what you want? Link to comment
Enargy, Posted June 2, 2015 Share Posted June 2, 2015 You wrote double letter if x == tonumber(xx) or y == tonumber(yy) or z == tonumber(zz) then Link to comment
brunob22 Posted June 2, 2015 Author Share Posted June 2, 2015 -- server side addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPositin(v) if x == tonumber(xx) and y == tonumber(yy) and z == tonumber(zz) then -- Here's only 1 vehicle or more if have 2 (or more) vehicles at the same coordinates destroyElement(v) end end end end end end) Use it with a trigger and for xx,yy and zz use the X,Y and Z columns. you code dont work. no erro. change code.. addEvent("b2.deletarcarro", true) addEventHandler("b2.deletarcarro", getRootElement(), function(deletarcarro1,xx,yy,zz) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if deletarcarro1 then for i , v in pairs (getElementsByType("vehicle")) do if getElementModel (v) == getVehicleModelFromName (tostring (deletarcarro1)) then local x,y,z = getElementPosition( v ) if x == tonumber(xx) or y == tonumber(yy) or z == tonumber(zz) then destroyElement(v) end end end end end end) punch it only deletes if you have one car on spawn But, this is not what you want? not 'cause if you have 2 car in the spawn not delete Link to comment
ALw7sH Posted June 2, 2015 Share Posted June 2, 2015 Post all your client&server codes and explain better what you wanna do otherwise idon't think anyone can help you Link to comment
brunob22 Posted June 3, 2015 Author Share Posted June 3, 2015 Post all your client&server codes and explain better what you wanna do otherwise idon't think anyone can help you I can not sorry What do I want to do and delete the car that was selected in gridlist over the past codes above does not delete the car if you have more than two in the same car spawn 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