Jump to content

userdata value ?!!


PaiN^

Recommended Posts

Posted
marker = createMarker ( 205.71435546875, 2511.4284667969, 16.558746337891 - 1, 'checkpoint', 20, 255, 255, 255, 255 ); 
createBlipAttachedTo ( marker, 9 ): 
  
addEventHandler ( 'onMarkerHit', marker,  
    function ( car ) 
        if getElementType ( car ) == 'vehicle' then 
            destroyElement ( car ); 
        end 
    end 
); 
  
setTimer ( function ( ) 
    for _,veh in next, getElementsByType ( 'vehicle' ) do 
        if isElementWithinMarker ( veh, marker ) then 
            destroyElement ( veh ); 
        end 
    end 
end, 1000, 0 ); 

Error : AD\server.lua:4: attempt to index a userdata value

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

try this:

local marker = createMarker ( 205.71435546875, 2511.4284667969, 16.558746337891 - 1, 'checkpoint', 20, 255, 255, 255, 255 ) 
createBlipAttachedTo ( marker, 9 ) 
  
addEventHandler ('onMarkerHit',marker,function ( car ) 
    if getElementType ( car ) == 'vehicle' then 
        destroyElement ( car ) 
    end 
end) 
  
setTimer (function () 
    for _,veh in ipairs(getElementsByType ( 'vehicle' )) do 
        if isElementWithinMarker ( veh, marker ) then 
            destroyElement ( veh ) 
        end 
    end 
end,1000,0) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

Working Thanx !

But i want to ask, What did you do ?

just reorginized it or what ..

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
Working Thanx !

But i want to ask, What did you do ?

just reorginized it or what ..

for _,veh in next, getElementsByType ( 'vehicle' ) do

use

ipairs 

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted

Oh, i didn't see that, Thanx MR.S3D and jaysds1

+ Can you tell me when this kind of error happen ? It's the first time i see it ...

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

Ok, got it

Thanx jaysds1 ^^

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
Don't tell me to read that, because I honestly have read that million times already. You can directly use next instead of pairs/ipairs.

Yes, i read that somewhere in the forum xD, That's why i started using next insted of ipairs / pairs .

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

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