• 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 Correct this please rep +

Silentsniper

New Member
Joined
Sep 20, 2009
Messages
81
Reaction score
0
Code:
local t = {
    storage = 32001,
    monster = {"Outlaw", {x=996, y=999, z=7}},
    msg = "Oh no! outlaw appeared, you have to kill him to get out of here.."
}
function onStepIn(cid, item, position, fromPosition)
        if item.id == 3415 then       
        doPlayerRemoveItem(cid,2160,10)
        doSummonCreature(t.monster[1], t.monster[2])
    end
    return TRUE
end
Im new to this, i want it so when i step on the tile, if i have the item 3415, it ill take 10 crystal coins and spawn a monster. I want it to only work if i have that item in my bag. Thanx :D
btw ill rep you dont worry xD please correct me.
 
Last edited:
Lua:
local pos = {x=90, y=120, z=7},
function onStepIn(cid, item, position, fromPosition)
	if getPlayerItemCount(cid,2160,10) == 1 then
           doPlayerRemoveItem(cid, 2160, 10)
              doSummonCreature(rat, pos)
               return doCreatureSay(cid, Oh no! A Rat appeared, you have to kill it to get out of here.., TALKTYPE_ORANGE_1)
	     else
                  return doPlayerSendCancel(cid, "Sorry but you need to have 10 crystal coins to enter.")
        end

Thanks & np.

dude that won't work -.- and stop copying others and start from 0... t_T
 
wait rofl. the script doesnt work for if getPlayerItemCount is in the script,this code shows up
Code:
[04/07/2010 20:40:41] Lua Script Error: [MoveEvents Interface] 
[04/07/2010 20:40:41] data/movements/scripts/monster1.lua:onStepIn

[04/07/2010 20:40:41] luaGetPlayerItemCount(). Player not found
 
Lua:
local config = {
	required_item = 2000, -- change me
	fee = {2160,10} --id, count
	monster = "Rat",
	success = "Oh no! A %s appeared, you have to kill it to get out of here...",
	fail = "Sorry but you need to have %s %s to enter."
}

function onStepIn(cid, item, position, fromPosition)
	if getPlayerItemCount(cid,config.required_item) > 0 then
		local i = getItemInfo(required_item)
		local article, name = i.article, i.name
		doPlayerRemoveItem(cid, config.fee[1],config.fee[2]) 
		doSummonCreature(config.monster,fromPosition)
		doCreatureSay(cid, string.format(config.success,article,name), TALKTYPE_ORANGE_1)
	else 
		doPlayerSendCancel(cid, string.format(config.fail,config.monster))
	end
end
 
omg lol wait i have a problem with it =[ heres what it say. i treid to fix it i cant.
Code:
[06/07/2010 01:15:34] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/monster1.lua)
[06/07/2010 01:15:34] data/movements/scripts/monster1.lua:4: '}' expected (to close '{' at line 1) near 'monster'
 
omg lol wait i have a problem with it =[ heres what it say. i treid to fix it i cant.
Code:
[06/07/2010 01:15:34] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/monster1.lua)
[06/07/2010 01:15:34] data/movements/scripts/monster1.lua:4: '}' expected (to close '{' at line 1) near 'monster'

Code:
  local config =  {
        required_item = 2000, -- change me
        fee = {2160,10}, --id, count
        monster = "Rat",
        success = "Oh no! A %s appeared, you have to kill it to get out of here...",
        fail = "Sorry but you need to have %s %s to enter."
}

function onStepIn(cid, item, position, fromPosition)
        if getPlayerItemCount(cid,config.required_item) > 0 then
                local i = getItemInfo(required_item)
                local article, name = i.article, i.name
                doPlayerRemoveItem(cid, config.fee[1],config.fee[2])
                doSummonCreature(config.monster,fromPosition)
                doCreatureSay(cid, string.format(config.success,article,name), TALKTYPE_ORANGE_1)
        else
                doPlayerSendCancel(cid, string.format(config.fail,config.monster))
        end
end
 
Code:
  local config =  {
        required_item = 2000, -- change me
        fee = {2160,10}, --id, count
        monster = "Rat",
        success = "Oh no! A %s appeared, you have to kill it to get out of here...",
        fail = "Sorry but you need to have %s %s to enter."
}

function onStepIn(cid, item, position, fromPosition)
        if getPlayerItemCount(cid,config.required_item) > 0 then
                local i = getItemInfo(required_item)
                local article, name = i.article, i.name
                doPlayerRemoveItem(cid, config.fee[1],config.fee[2])
                doSummonCreature(config.monster,fromPosition)
                doCreatureSay(cid, string.format(config.success,article,name), TALKTYPE_ORANGE_1)
        else
                doPlayerSendCancel(cid, string.format(config.fail,config.monster))
        end
end

Who made that? hah he/she uses Player insted of Creature hah..
 
my server really hates me.without the item puppet
Code:
[06/07/2010 23:05:05] data/movements/scripts/monster1.lua:17: bad argument #3 to 'format' (string expected, got no value)
[06/07/2010 23:05:05] stack traceback:
[06/07/2010 23:05:05] 	[C]: in function 'format'
[06/07/2010 23:05:05] 	data/movements/scripts/monster1.lua:17: in function <data/movements/scripts/monster1.lua:9>
with the item in back pack:
Code:
[06/07/2010 23:06:30] Lua Script Error: [MoveEvents Interface] 
[06/07/2010 23:06:30] data/movements/scripts/monster1.lua:onStepIn

[06/07/2010 23:06:30] data/movements/scripts/monster1.lua:11: attempt to call global 'getItemInfo' (a nil value)
[06/07/2010 23:06:30] stack traceback:
[06/07/2010 23:06:30] 	data/movements/scripts/monster1.lua:11: in function <data/movements/scripts/monster1.lua:9>
 
I made it, but I don't understand what you're pointing out.

doCreatureAddHealth(cid,)
^ new

doPlayerAddHealth(cid,)
^ old && ugly, all I wanned to say.

And you the other guy, Im not learning you lua.
 
@unknown666 I just say that he uses the old functions, Elf made the Creature functions in 0.3 and tala Player in 0.2

+ Im not the guy that makes 100 script of the same type just re-tabbing the script for other players mouth system? wtf, dosent even work on 0.3.5, 0.3.6 as you said it did, im not the n**b.
 
Back
Top