Jump to content

Help-me pls?


Recommended Posts

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

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
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 

CHupRRU.png

I do not want to delete the text, but the car he generate the gridlist

Link to comment
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
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

IM0f6Nn.png

Link to comment
    -- 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
    -- 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
    -- 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
    -- 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
    -- 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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...