Jump to content

help createPickup.


Recommended Posts

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 by Guest
Link to comment

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

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

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

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

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
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
  
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
  
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 :lol: 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

WHOOO, fix the code :o

  
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 :D

Link to comment

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