Jorgito'Molina Posted April 9, 2013 Share Posted April 9, 2013 (edited) Code is normal. police = createPickup ( 2251.99, 2489.39, 10.99, 1, 25, 10000, 60 ) function MarkerHit( thePlayer ) if not (getElementModel( thePlayer ) == 29) then cancelEvent() end end addEventHandler ( "onPickupHit", police, MarkerHit ) PROBLEM OF CODE. police = createPickup = { 2251.99, 2489.39, 10.99, 1, 25, 10000, 60, 2295.36, 2461.00, 1082, 0, 100, 10000, 60, } function MarkerHit( thePlayer ) if not (getElementModel( thePlayer ) == 29 or 181) then cancelEvent() end end addEventHandler ( "onPickupHit", police, MarkerHit ) easy problem, help Edited April 9, 2013 by Guest Link to comment
Kenix Posted April 9, 2013 Share Posted April 9, 2013 You make nonsense without Lua knowledge. Learn https://forum.multitheftauto.com/viewto ... 972b3f97cc Link to comment
Jorgito'Molina Posted April 9, 2013 Author Share Posted April 9, 2013 Yes, yes... i am noob, in lua, I have 13 years problem? Link to comment
Sasu Posted April 9, 2013 Share Posted April 9, 2013 What is your problem? He is helping you. well, What do you want that script do? Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 put two pickup private. Link to comment
فاّرس Posted April 10, 2013 Share Posted April 10, 2013 i'm not good in the table... try this : local pickup = { [1] = { 2251.99, 2489.39, 10.99, 1, 25, 10000, 60 }, [2] = { 2295.36, 2461.00, 1082, 0, 100, 10000, 60 } } for _, p in ipairs ( pickup ) do police = createPickup ( p[1], p[2], p[3], p[4], p[5], p[6], p[7] ) end function pickupHit( player ) if not (getElementModel( player ) == 29 or 181) then cancelEvent() end end addEventHandler ( "onPickupHit", police, pickupHit ) Link to comment
Moderators IIYAMA Posted April 10, 2013 Moderators Share Posted April 10, 2013 try this. As far I know addEventHandlers don't support tables. Just one single element. Or you should have to use root and check in the function if the element is true. function MarkerHit( thePlayer ) local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then cancelEvent() end end addEventHandler ( "onPickupHit", createPickup(2251.99, 2489.39, 10.99, 1, 25, 10000, 60), MarkerHit ) addEventHandler ( "onPickupHit", createPickup(2295.36, 2461.00, 1082, 0, 100, 10000, 60), MarkerHit ) or local pickups = {[createPickup(2251.99, 2489.39, 10.99, 1, 25, 10000, 60)]=true,[createPickup(2295.36, 2461.00, 1082, 0, 100, 10000, 60)]=true} addEventHandler ( "onPickupHit", root, function ( thePlayer ) if pickups[source] then local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then cancelEvent() end end end) Link to comment
Baseplate Posted April 10, 2013 Share Posted April 10, 2013 Or police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if (source == police1) or (source == police2) then if not (getElementModel( thePlayer ) == 29 or 181) then cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) Link to comment
iPrestege Posted April 10, 2013 Share Posted April 10, 2013 Or police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if (source == police1) or (source == police2) then if not (getElementModel( thePlayer ) == 29 or 181) then cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) This will check 29 model only . Link to comment
Moderators IIYAMA Posted April 10, 2013 Moderators Share Posted April 10, 2013 This will check 29 model only . Wasn't a mistake by samer. local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then end Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 Thanks all, code running. Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 put two pickup private is running perfect... for not working two skins. police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if (source == police1) or (source == police2) then if not (getElementModel( thePlayer ) == 29 or 181 ) then cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) problem in line 7. Link to comment
iPrestege Posted April 10, 2013 Share Posted April 10, 2013 This will check 29 model only . Wasn't a mistake by samer. local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then end Did you read this post? Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 Yes, reading all the post. Link to comment
iPrestege Posted April 10, 2013 Share Posted April 10, 2013 local police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) local police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if ( source == police1 or source == police2 ) then local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then end cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 local police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) local police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if ( source == police1 or source == police2 ) then local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then end cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) not working . Link to comment
Moderators IIYAMA Posted April 10, 2013 Moderators Share Posted April 10, 2013 local police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) local police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if ( source == police1 or source == police2 ) then local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) I expect people to place my given "end", at the correct location. I probably confused people O_o Link to comment
iPrestege Posted April 10, 2013 Share Posted April 10, 2013 local police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) local police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if ( source == police1 or source == police2 ) then local model = getElementModel( thePlayer ) if model~= 29 or model~= 181 then cancelEvent() end end end addEventHandler ( "onPickupHit", root, MarkerHit ) Ah,Sorry Forget Man I Was Trying To Make It return false end; and add another end and foreget to do it sorry and thanks . I expect people to place my given "end", at the correct location. I probably confused people O_o Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 not working, sorry Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 Post ur meta.xml file . Link to comment
Jorgito'Molina Posted April 10, 2013 Author Share Posted April 10, 2013 WHOOO, fix the code local police1 = createPickup (2251.99, 2489.39, 10.99, 1, 25, 10000, 60) local police2 = createPickup (2295.36, 2461.00, 1082, 0, 100, 10000, 60) function MarkerHit( thePlayer ) if ( source == police1 or source == police2 ) then local model = getElementModel( thePlayer ) if model~= 29 then if model~= 181 then cancelEvent() end end end end addEventHandler ( "onPickupHit", root, MarkerHit ) thanks to Mr.Pres[T]ege Samer The Best IIYAMA Link to comment
Moderators IIYAMA Posted April 10, 2013 Moderators Share Posted April 10, 2013 np. Mr.Pres[T]ege is the best. 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