Jorgito'Molina Posted April 9, 2013 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
Kenix Posted April 9, 2013 Posted April 9, 2013 You make nonsense without Lua knowledge. Learn https://forum.multitheftauto.com/viewto ... 972b3f97cc
Jorgito'Molina Posted April 9, 2013 Author Posted April 9, 2013 Yes, yes... i am noob, in lua, I have 13 years problem?
Sasu Posted April 9, 2013 Posted April 9, 2013 What is your problem? He is helping you. well, What do you want that script do?
فاّرس Posted April 10, 2013 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 )
Moderators IIYAMA Posted April 10, 2013 Moderators 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)
Baseplate Posted April 10, 2013 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 )
iPrestege Posted April 10, 2013 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 .
Moderators IIYAMA Posted April 10, 2013 Moderators 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
Jorgito'Molina Posted April 10, 2013 Author 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.
iPrestege Posted April 10, 2013 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?
iPrestege Posted April 10, 2013 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 )
Jorgito'Molina Posted April 10, 2013 Author 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 .
Moderators IIYAMA Posted April 10, 2013 Moderators 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
iPrestege Posted April 10, 2013 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
Jorgito'Molina Posted April 10, 2013 Author 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
Moderators IIYAMA Posted April 10, 2013 Moderators Posted April 10, 2013 np. Mr.Pres[T]ege is the best.
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