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

Lua script help

neji75

New Member
Joined
Jan 15, 2010
Messages
18
Reaction score
0
Location
Orlando, FL
hi. i was working on my first item lua, it work in the begging but not it wont work. can anyone help me out plz?

Code:
local firstItems = {2489, 2647, 2457, 2525}

function onLogin(cid)
	if getPlayerStorageValue(cid, 30001) == -1 then
		for i = 1, table.maxn(firstItems) do
			doPlayerAddItem(cid, firstItems[i], 1)
		end
		doPlayerAddItem(cid, getPlayerSex(cid) == 0 and )
		local bag = doPlayerAddItem(cid, 1988, 1)
		doAddContainerItem(bag, 2674, 25)
		doAddContainerItem(bag, 2417, 1)
		doAddContainerItem(bag, 2428, 1)
		doAddContainerItem(bag, 2383, 1)
		doAddContainerItem(bag, 2190, 1)
		doAddContainerItem(bag, 2182, 1)
		doAddContainerItem(bag, 2456, 1)
		setPlayerStorageValue(cid, 30001, 1)
	end
	return TRUE
end
 
Here is official first item, from mods (TFS 0.3.6pl1)
XML:
<?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}
		}
	]]></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, 2651, 1)
			else
				doPlayerAddItem(cid, 2650, 1)
			end

			doAddContainerItem(doPlayerAddItem(cid, 1987, 1), 2674, 1)
			setPlayerStorageValue(cid, config.storage, 1)
			return true
		end
	]]></event>
</mod>
Compare this script with your.
 
Back
Top