Jump to content

[help] isElementWithinColShape


Reggae

Recommended Posts

local pickup = createPickup(2487.1398925781,-1667.7604980469,13.34375,3,1273,0) 
addEventHandler("onPickupHit",pickup,function(player) 
    setElementData(player,"used_pickup",true) 
    outputChatBox("Enter to buy /comprar",player) 
end) 
addCommandHandler("comprar",function(player) 
    if getElementData(player,"used_pickup") then 
        takePlayerMoney(player,50) 
    end 
end) 
function ColShapeHit ( thePlayer, matchingDimension ) 
    local detection = isElementWithinColShape ( thePlayer, pickup ) 
    detection = detection and getElementDimension( thePlayer ) == getElementDimension( pickup ) 
    if detection then 
            outputChatBox("Command /comprar off",player) 
    end 

I want the / buy command only works for those who have on pickup, but does not work.

Anyone can use anywhere.

the only for Those Who Are on the pickup can use the script? help me

Arrange the script for me plis

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 ( "Enter to buy /comprar", player ) 
    end 
) 
  
addCommandHandler ( "comprar", 
    function ( player ) 
        local detection = isElementWithinColShape ( player, getElementColShape ( pickup ) ) 
        if getElementData ( player, "used_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...