• 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!

Can someone fix my first_items script?

Cornwallis

Member
Joined
Jan 3, 2010
Messages
480
Reaction score
16
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			items = {2050, 2382, 2509, 2460, 2643,2478,}
		}
	]]></config>
	<event type="login" name="FirstItems" event="script"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
			if(getPlayerStorageValue(cid, config.storage) > 0) then
				return true
			end

			for _, id in ipairs(config.items) do
				doPlayerAddItem(cid, id, 1)
			end

			if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
				doPlayerAddItem(cid, 2465, 1)
			end

			doAddContainerItem(doPlayerAddItem(cid, 1988, 1), 2789, 100), 2152, 75), 2190, 1), 2182, 1), 2389, 1), 2383, 1), 7620, 1), 5710, 1), 2120, 1), 

2428, 1), 2321, 1)
			setPlayerStorageValue(cid, config.storage, 1)
			return true
		end
	]]></event>
</mod>
 
it crashes then says :
Code:
> Loading firstitems.xml...Assertion failed: m_scriptEnvIndex >= 0 && m_scriptEnvIndex < 21, file ../luascript.h, line 251
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			items = {2050, 2382, 2509, 2460, 2643,2478,}
		}
	]]></config>
	<event type="login" name="FirstItems" event="script"><![CDATA[
		domodlib('firstitems_config')

		function onLogin(cid)
			if(getPlayerStorageValue(cid, config.storage) > 0) then
				return true
			end

			for _, id in ipairs(config.items) do
				doPlayerAddItem(cid, id, 1)
			end

			if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
				doPlayerAddItem(cid, 2465, 1)
			end

			doAddContainerItem(doPlayerAddItem(cid, 1988, 1), 2789, 100), 2152, 75), 2190, 1), 2182, 1), 2389, 1), 2383, 1), 7620, 1), 5710, 1), 2120, 1), 2428, 1), 2321, 1)
			setPlayerStorageValue(cid, config.storage, 1)
			return true
		end
	]]></event>
</mod>

try now
 
Back
Top