Miika Posted June 28, 2014 Share Posted June 28, 2014 I edit the "mysterybag" resource. I want the bag to give 100% armor, but its says: "You get (random money) and "false%" armor" The code is: -- You can add more locations -- {x, y, z} local mbag = { {2422.3,-2261.6,16}, {1758.9,-2767.9,1.7}, {2493.3,-951.8,82.25}, {815.7,-1108.2,25.8}, {390.9,-2054.3,13.8}, {-719.05,-1938.8,8.35}, {-625.7,-2249.5,23.05}, {-1812.3,-168.5,18.2}, {-2659.5,1528.05,54.79}, {-1733.76,194.75,3.6}, {-2535.5,40.15,8.5}, {-1804.85,558.45,35.15}, {-752.6,-131.6,65.8}, } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) outputChatBox( "Rahasäkki on spawnannut!", root, 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 3000, 5000 ) armor = getPedArmor ( 100 ) givePlayerMoney(player,randomMoney) setPedArmor ( player, 100 ) outputChatBox("You get " .. tostring(randomMoney) .."$ and ".. tostring(armor) .."% Armor", player, 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) Sorry my bad english... Link to comment
Anubhav Posted June 28, 2014 Share Posted June 28, 2014 -- You can add more locations -- {x, y, z} local mbag = { {2422.3,-2261.6,16}, {1758.9,-2767.9,1.7}, {2493.3,-951.8,82.25}, {815.7,-1108.2,25.8}, {390.9,-2054.3,13.8}, {-719.05,-1938.8,8.35}, {-625.7,-2249.5,23.05}, {-1812.3,-168.5,18.2}, {-2659.5,1528.05,54.79}, {-1733.76,194.75,3.6}, {-2535.5,40.15,8.5}, {-1804.85,558.45,35.15}, {-752.6,-131.6,65.8}, } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) outputChatBox( "Rahasäkki on spawnannut!", root, 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 3000, 5000 ) givePlayerMoney(player,randomMoney) setPedArmor ( player, 100 ) local armor = getPedArmor( player ) outputChatBox("You get " .. tostring(randomMoney) .."$ and ".. tostring(armor) .."% Armor", player, 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) Link to comment
Miika Posted June 28, 2014 Author Share Posted June 28, 2014 -- You can add more locations -- {x, y, z} local mbag = { {2422.3,-2261.6,16}, {1758.9,-2767.9,1.7}, {2493.3,-951.8,82.25}, {815.7,-1108.2,25.8}, {390.9,-2054.3,13.8}, {-719.05,-1938.8,8.35}, {-625.7,-2249.5,23.05}, {-1812.3,-168.5,18.2}, {-2659.5,1528.05,54.79}, {-1733.76,194.75,3.6}, {-2535.5,40.15,8.5}, {-1804.85,558.45,35.15}, {-752.6,-131.6,65.8}, } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) outputChatBox( "Rahasäkki on spawnannut!", root, 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 3000, 5000 ) givePlayerMoney(player,randomMoney) setPedArmor ( player, 100 ) local armor = getPedArmor( player ) outputChatBox("You get " .. tostring(randomMoney) .."$ and ".. tostring(armor) .."% Armor", player, 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) Yeah! It working! Thx! Link to comment
Anubhav Posted June 28, 2014 Share Posted June 28, 2014 Lol you checked the armor before giving it was only the problem You can ask me help whenever you want. 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