PaiN^ Posted April 21, 2013 Posted April 21, 2013 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 !
Jaysds1 Posted April 21, 2013 Posted April 21, 2013 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/
PaiN^ Posted April 21, 2013 Author Posted April 21, 2013 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 !
MR.S3D Posted April 21, 2013 Posted April 21, 2013 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 my Email : [email protected] Programming level: 90%
Jaysds1 Posted April 21, 2013 Posted April 21, 2013 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 and you had a ' : ' at the end of line 2. 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/
PaiN^ Posted April 21, 2013 Author Posted April 21, 2013 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 !
Jaysds1 Posted April 21, 2013 Posted April 21, 2013 It usually happens when you're trying to index a table, so, when you put ' : ' at the end of line 2, it's attempting to index a table. 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/
PaiN^ Posted April 21, 2013 Author Posted April 21, 2013 Ok, got it Thanx jaysds1 ^^ " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
Jaysds1 Posted April 21, 2013 Posted April 21, 2013 np man 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/
ixjf Posted April 22, 2013 Posted April 22, 2013 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 What's the problem with next? I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
Jaysds1 Posted April 22, 2013 Posted April 22, 2013 (edited) WHAT EVER!!! I didn't say you can't/shouldn't use next the problem was the ' : '. Edited April 22, 2013 by Guest 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/
ixjf Posted April 22, 2013 Posted April 22, 2013 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. I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
PaiN^ Posted April 23, 2013 Author Posted April 23, 2013 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 , 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 !
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