wrong
local aPickup = createPickup (420.14,-2537.42,32.30, 2, 24, 3000, 0 )
function pickedUpWeaponCheck ( player )
local money = getPlayerMoney(player) -- is getPlayerMoney not getElementMoney
if (money > 499) then
outputChatBox ( "You have picked up a Deagle for $500", player ) --Display this message in the chat box
giveWeapon ( player, 24, 50 )
end
end
addEventHandler ( "onPickupHit", aPickup, pickedUpWeaponCheck )
but the coneption is wrong!
this will give you weapon when you pick it up already!
so just cancel availability of picking it up if player have < 500!
and your indentation = randomness!
local aPickup = createPickup (420.14,-2537.42,32.30, 2, 24, 3000, 0 )
addEventHandler("onPickupHit", aPickup, function(player)
local money = getPlayerMoney(player)
if (money<500) then cancelEvent() return false end -- cancel pickup picking up (cancelEvent) and stop the function (return false) if player dont have any money
-- this will be done when player have enough money
outputChatBox("You have picked up a Deagle for $500", player)
takePlayerMoney(player, 500) -- you forgot to take money from player before!!
-- no need to give weapon - pickup is already doing this when picked up
end)