• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Multiple Marijuana Plants

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Put this in actions
actions.xml
Code:
		<action uniqueid="3000" script="potbush0.lua"/>
	<action uniqueid="3001" script="potbush1.lua"/>
	<action uniqueid="3002" script="potbush2.lua"/>
	<action uniqueid="3003" script="potbush3.lua"/>
	<action uniqueid="3004" script="potbush4.lua"/>	
	<action uniqueid="3005" script="potbush5.lua"/>	
	<action uniqueid="3006" script="potbush6.lua"/>	
	<action uniqueid="3007" script="potbush7.lua"/>	
	<action uniqueid="3008" script="potbush8.lua"/>	
	<action uniqueid="3009" script="potbush9.lua"/>

potbush0.lua
Code:
local plant = 3000 --put unique id of plant here
local respawnminimum = 15 --put minimum number of minutes for plant to respawn
local respawnmaximum = 120 --put maximum number of minutes for plant to respawn
local receiveminimum = 1 --put the lowest amount of the item you want to get here
local receivemaximum = 3 --put the maximum amount of the item you want to get here



local function restore(cid, storage)
	setPlayerStorageValue(cid, plant, 1)
		return true
end	
	
function onUse(cid, item, frompos, item2, topos)
if item.uid == plant and
		getPlayerStorageValue(cid, plant) < 2
		then	
			setPlayerStorageValue(cid, plant, 2)
			doSendMagicEffect(getPlayerPosition(cid), 13)	
			doCreatureSay(cid, "You have come across some marijuana.", TALKTYPE_ORANGE_1)
			doPlayerAddItem(cid, 5953, (math.random(receiveminimum,receivemaximum)))
				addEvent(restore, math.random (respawnminimum,respawnmaximum) * 60 * 1000, cid)
elseif
	getPlayerStorageValue(cid, plant) == 2
		then
			doCreatureSay(cid, "This plant has already been harvested, wait for it to grow back.", TALKTYPE_ORANGE_1)		
				return true
			end
				return true
			end

Copy this file, rename it "potbush1.lua" and edit the top "plant" to 3001, thats the only thing you have to change, then make the file potbush2.lua and make plant be 3002 and so on until you have 10 files (last one would be potbush9).

I made it so you can easily change what storage and unique (whatever unique ID you use, thats the storage it uses) what unique ID you want to use. You can also easily change the minimum and maximum respawn time in minutes and also the amount you get from using the object so you can play around with it. Since the actions.xml does not have an item ID in it, you can use whatever you want, you could use a stone wall for whatever reason and set its unique ID to 3000 and it will give you marijuana leaves and respawn (haha). The script is so user friendly that all you have to change for a new object is the top line, where it says "plant = 3000", since it does not call for any other specific thing.

I hope you guys like it, took me (noobie scripter) about 4 to 5 hours getting this thing to work but it finally fully does work now, I tested it a few times and there seem to be no errors.
 
Last edited:
Back
Top