Jump to content

[help] onPickupHit :S


Reggae

Recommended Posts

casinhaverde = createPickup ( 2487.1398925781,-1667.7604980469,13.34375, 3, 1273, 0 ) 
  
function hitcasinha ( thePlayer, commandName, amount ) 
local amount = 50 
local takePlayerMoney = amount 
takePlayerMoney2 ( thePlayer, tonumber(amount) ) 
   outputChatBox ( "Propriedades: Digite /comprar", thePlayer )  
addCommandHandler ( "comprar", takePlayerMoney ) 
end 
addEventHandler ( "onPickupHit", casinhaverde, hitcasinha ) 

I want only the player who has over pickup can use the command /comprar

and so he use the command, it loses £ 50..

Not Worked fix for my ?

Link to comment
  
local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) 
addEventHandler("onPickupHit",pickup,function(player) 
    setElementData(player,"used_pickup",true) 
    outputChatBox("Propriedades: Digite /comprar",player) 
end) 
addCommandHandler("comprar",function(player) 
    if getElementData(player,"used_pickup") then 
        takePlayerMoney(player,50) 
    end 
end) 
  

Link to comment
  
local colshape = getElementColShape(createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0)) 
addEventHandler("onColShapeHit",colshape,function(element,dimension) 
    if getElementType(element) == "player" and dimension then 
        -- the code to be executed when he enters the pickup 
    end 
end) 
addEventHandler("onColShapeLeave",colshape,function(element,dimension) 
    if getElementType(element) == "player" and dimension then 
        -- the code to be executed when he leaves the pickup 
    end 
end) 
  

Link to comment
local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) 
addEventHandler("onPickupHit",pickup,function(player) 
    outputChatBox("Propriedades: Digite /comprar",player) 
        takePlayerMoney(player,50) 
end) 
addCommandHandler("comprar",function(player) 
    if isElementWithinColShape(player,getElementColShape(pickup)) then 
    end 
end) 
  

??

Edited by Guest
Link to comment
  
local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) 
addEventHandler("onPickupHit",pickup,function(player) 
    outputChatBox("Propriedades: Digite /comprar",player) 
end) 
addCommandHandler("comprar",function(player) 
    if isElementWithinColShape(player,getElementColShape(pickup)) then 
        takePlayerMoney(player,50) 
    end 
end) 
  

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