Sign in to follow this  
iJustD

Need help with script

Recommended Posts

[2017-03-10 16:55:55] WARNING: admin/server/admin_server.lua:1163: Bad argument @ 'destroyElement' [Expected element at argument 1] < Console log . I cant fix it help me plz.

Script is : 

            elseif ( action == "setcolor" ) then
                    r, g, b = hex2rgb(data[1])
                    r2, g2, b2 = hex2rgb(data[2])
                    r3, g3, b3 = hex2rgb(data[3])
                    r4, g4, b4 = hex2rgb(data[4])
                    if ( not setVehicleColor ( vehicle, r, g, b, r2, g2, b2, r3, g3, b3, r4, g4, b4 ) ) then
                        action = nil
                    end
            elseif ( action == "setlights" ) then
                    r, g, b = hex2rgb(data[1])
                    if ( not setVehicleHeadLightColor ( vehicle, r, g, b) ) then
                        action = nil
                    end
            elseif ( action == "setplates" ) then
                mdata = data[1]
                setVehiclePlateText ( vehicle, data[1] )
            elseif ( action == "blowvehicle" ) then
                setTimer ( blowVehicle, 100, 1, vehicle )
            elseif ( action == "destroyvehicle" ) then
                setTimer ( destroyElement, 100, 1, vehicle )
            else
                action = nil
            end

Share this post


Link to post

From what I can see is you've defined what destroyElement is doing. Example:

 

The way you've wrote it:

setTimer ( destroyElement, 100, 1, vehicle )

The way I would write it:

setTimer ( destroyElement(ElementName), 100, 1, vehicle )

 

Now I might be wrong but if you put inside the brackets the element you're trying to destroy it will probably fix it.

Share this post


Link to post
18 hours ago, Unitts said:

The way I would write it:


setTimer ( destroyElement(ElementName), 100, 1, vehicle )

 

Now I might be wrong but if you put inside the brackets the element you're trying to destroy it will probably fix it.

yes you are wrong as setTimer will provide vehicle as a parameter and what you wrote will cause the error

this

[16:16:11] WARNING: lol\x.lua:91: Bad argument @ 'destroyElement' [Expected elem
ent at argument 1, got nil]
[16:16:11] WARNING: lol\x.lua:91: Bad argument @ 'setTimer' [Expected function a
t argument 1, got boolean]

  • Like 1

Share this post


Link to post
On 3/11/2017 at 10:49, Ayush Rathore said:

yes you are wrong as setTimer will provide vehicle as a parameter and what you wrote will cause the error

this

[16:16:11] WARNING: lol\x.lua:91: Bad argument @ 'destroyElement' [Expected elem
ent at argument 1, got nil]
[16:16:11] WARNING: lol\x.lua:91: Bad argument @ 'setTimer' [Expected function a
t argument 1, got boolean]

My bad hmm

Share this post


Link to post
Just now, Ayush Rathore said:

no problem as now you know

Only other thing I can assume is hes not defined the element 'vehicles'

Share this post


Link to post
Just now, Unitts said:

Only other thing I can assume is hes not defined the element 'vehicles'

well he has not given full script :D

  • Like 1

Share this post


Link to post
2 hours ago, Ayush Rathore said:

well he has not given full script :D

 

2 hours ago, Unitts said:

That is true mate :D

This is the default admin resource.

 

On 3/10/2017 at 11:03, iJustD said:

[2017-03-10 16:55:55] WARNING: admin/server/admin_server.lua:1163: Bad argument @ 'destroyElement' [Expected element at argument 1] < Console log . I cant fix it help me plz.

 

I suggest redownloading the admin resource from here or post the changes you have made to the resource that may be the cause of the error.

Share this post


Link to post

I just wanted to point out that you should honestly give more descriptive titles to attract attention from the right people who can actually help you.

  • Like 1

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.