• 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 Help with a little script

Wraskly

Member
Joined
Jun 17, 2010
Messages
244
Reaction score
7
Okay, so in my server, the player creates an account online, and then chooses a vocation in game, When he "uses" a statue he chooses that vocation, but i cant figure out how to give him his first items when he presses on the statue because of course when you log into game with no vocation you don't get any items, so how could I make my firstitems script work when the player presses the statue and auto gets the items of that vocation? Here's my firstitems:

Lua:
<?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, 30001) == -1 then
        if getPlayerVocation(cid) == 1 then
            doPlayerAddItem(cid, 2190, 1)--Wand Of Vortex
            doPlayerAddItem(cid, 2175, 1)--Spellbook
            doPlayerAddItem(cid, 8820, 1)--Mage hat
            doPlayerAddItem(cid, 8819, 1)--Magician Robe
            doPlayerAddItem(cid, 2648, 1)--Chain Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2268, 1)--SD
            doPlayerAddItem(cid, 2282, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Wizard items.")
        end
        if getPlayerVocation(cid) == 2 then
            doPlayerAddItem(cid, 2182, 1)--Snakekbite Rod
            doPlayerAddItem(cid, 2175, 1)--Spellbook
            doPlayerAddItem(cid, 8820, 1)--Mage hat
            doPlayerAddItem(cid, 8819, 1)--Magician Robe
            doPlayerAddItem(cid, 2648, 1)--Chain Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2268, 1)--SD
            doPlayerAddItem(cid, 2282, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Prophet items.")
        end
        if getPlayerVocation(cid) == 3 then
            doPlayerAddItem(cid, 2389, 2)--Spear
            doPlayerAddItem(cid, 2530, 1)--Copper Shield
            doPlayerAddItem(cid, 2660, 1)--Cloak
            doPlayerAddItem(cid, 8923, 1)--Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
			doPlayerAddItem(cid, 2456, 1)--Bow
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2300, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Assassin items.")
        end
        if getPlayerVocation(cid) == 4 then
            doPlayerAddItem(cid, 2481, 1)--Soldier Helmet
            doPlayerAddItem(cid, 2465, 1)--Brass Armor
            doPlayerAddItem(cid, 2509, 1)--Steel Shield
            doPlayerAddItem(cid, 2478, 1)--Brass Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 8602, 1)--Sword
            doPlayerAddItem(cid, 2439, 1)--Club
            doPlayerAddItem(cid, 8601, 1)--Axe
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2306, 1)--MANA    
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Warrior items.")
        end
            setPlayerStorageValue(cid, 30001, 1)
    end
     return TRUE
end 
	]]></event>
</mod>
 
try changing this to a time period?

Lua:
<event type="ontimer" time="1000" name="FirstItems" event="script">

Idk, something like this so it checks, but best way i think is to change the statue somehow so they get relogged and then they will get it.
 
Nope, did nothing...

Got this error
Code:
 Loading firstitems.xml...[Error - CreatureEvent::configureEvent] No valid type for creature event.ontimer
 
Last edited:
Code:
function onUse(cid, fromposition, itemEx, toposition)
   if item.uid == xxxx then -- uniqueid of the statue
    if getPlayerStorageValue(cid, 30001) == -1 then
        if getPlayerVocation(cid) == 1 then
            doPlayerAddItem(cid, 2190, 1)--Wand Of Vortex
            doPlayerAddItem(cid, 2175, 1)--Spellbook
            doPlayerAddItem(cid, 8820, 1)--Mage hat
            doPlayerAddItem(cid, 8819, 1)--Magician Robe
            doPlayerAddItem(cid, 2648, 1)--Chain Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2268, 1)--SD
            doPlayerAddItem(cid, 2282, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Wizard items.")
        end
        if getPlayerVocation(cid) == 2 then
            doPlayerAddItem(cid, 2182, 1)--Snakekbite Rod
            doPlayerAddItem(cid, 2175, 1)--Spellbook
            doPlayerAddItem(cid, 8820, 1)--Mage hat
            doPlayerAddItem(cid, 8819, 1)--Magician Robe
            doPlayerAddItem(cid, 2648, 1)--Chain Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2268, 1)--SD
            doPlayerAddItem(cid, 2282, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Prophet items.")
        end
        if getPlayerVocation(cid) == 3 then
            doPlayerAddItem(cid, 2389, 2)--Spear
            doPlayerAddItem(cid, 2530, 1)--Copper Shield
            doPlayerAddItem(cid, 2660, 1)--Cloak
            doPlayerAddItem(cid, 8923, 1)--Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
			doPlayerAddItem(cid, 2456, 1)--Bow
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2300, 1)--MANA
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Assassin items.")
        end
        if getPlayerVocation(cid) == 4 then
            doPlayerAddItem(cid, 2481, 1)--Soldier Helmet
            doPlayerAddItem(cid, 2465, 1)--Brass Armor
            doPlayerAddItem(cid, 2509, 1)--Steel Shield
            doPlayerAddItem(cid, 2478, 1)--Brass Legs
            doPlayerAddItem(cid, 2173, 1)--Amulet of loss
            doPlayerAddItem(cid, 2643, 1)--Leather Boots
            doPlayerAddItem(cid, 2004, 1)--Golden Backpack
            doPlayerAddItem(cid, 8602, 1)--Sword
            doPlayerAddItem(cid, 2439, 1)--Club
            doPlayerAddItem(cid, 8601, 1)--Axe
            doPlayerAddItem(cid, 2152, 25)--Money
            doPlayerAddItem(cid, 2273, 1)--UH
            doPlayerAddItem(cid, 2306, 1)--MANA    
        doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." you now have the first Warrior items.")
        end
            setPlayerStorageValue(cid, 30001, 1)
    end
     return TRUE
end

Try this one...
 
just add that exact script? because its an xml file, that wouldnt work or do i just replace starting at
Lua:
funtctiononlogin
 
Back
Top