Raylander Posted July 27, 2018 Share Posted July 27, 2018 I need help from you guys, I'm doing a script to drop moneyfrom pedestrians, but I can't. --[[ Triggers whenever a ped is killed ]]-- function killedPed(totalAmmo, killer, killerWeapon, bodypart, stealth, npc) -- Get profitability multiplier local probability_of_richness = math.random(1,1000) if probability_of_richness < 900 then probability_of_richness = 1 elseif probability_of_richness < 975 then probability_of_richness = 3 elseif probability_of_richness < 999 then probability_of_richness = 10 else probability_of_richness = 100 end -- Create a money pickup at the position of the dead bot local x,y,z = getElementPosition(source) npc[killer] = math.random(1,40)*probability_of_richness -- Max profit: $4´000 -- Make the pickup and make sure it's removed after 2 minutes if not picked up local pickup = createPickup(x, y, z, 3, 1212, 120000, npc[killer]) if pickup then setTimer(destroyMinutePickup, 120*1000, 1, pickup) addEventHandler("onPickupHit", pickup, givePickupMoney) end end addEventHandler("onPedWasted", root, killedPed) --[[ Destroy the pickup after given time ]]-- function destroyMinutePickup(pickup) if isElement(pickup) then removeEventHandler("onPickupHit", pickup, givePickupMoney) destroyElement(pickup) end end --[[ Make the robber wanted on money pickup ]]-- function givePickupMoney(plr) if not npc[plr] then npc[plr] = math.random(1,50) end removeEventHandler("onPickupHit", source, givePickupMoney) destroyElement(source) givePlayerMoney(plr, npc[plr]) -- Get wanted for stealing money setWl(source, round(wanted_level, 2), 10, "Você cometeu o crime de roubo") end Link to comment
Discord Moderators Pirulax Posted July 30, 2018 Discord Moderators Share Posted July 30, 2018 use the code tags pls. 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