Reggae Posted March 22, 2014 Share Posted March 22, 2014 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
cheez3d Posted March 22, 2014 Share Posted March 22, 2014 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
Reggae Posted March 22, 2014 Author Share Posted March 22, 2014 I want only those who are on the blip can use the command /comprar. that way you quoted anyone can buy. help Link to comment
cheez3d Posted March 22, 2014 Share Posted March 22, 2014 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
Reggae Posted March 22, 2014 Author Share Posted March 22, 2014 (edited) 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 March 23, 2014 by Guest Link to comment
cheez3d Posted March 23, 2014 Share Posted March 23, 2014 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
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