• 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 Prest's Scripting Help

Prest

الله ليس أكبر
Joined
Oct 14, 2010
Messages
5,385
Reaction score
265
Location
By Polar
Okay so I will start learning LUA using this tutorial, I want you guys to tell me if theres something wrong or how to improve something


Okay so my first script:
I want it that when you use id 5906 (demon dust) a demon is created (not summon) and if you arent using the correct dust it says ""You are not using the correct item!"
so is this correct?:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 5906 then
               doCreateMonster(Demon, pos)
    else if item.itemid == 5906 FALSE
               doPlayerSendTextMessage(cid,21,"You are not using the correct item!")
    end
    return TRUE

Also as I dont have any ot files im writing in Notepad lol so idk how wtf is with the spaces and all that..
 
Last edited:
Download a server just to test your scripts
A good program to help you with scripts is this:
MEGAUPLOAD - The leading online storage and file delivery service
This is the one I use, I find it really useful, If you find a better one then use that.
Follow thie tutorial you're using, its really helpful.

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
         doSummonCreature("Demon", {x=??, y=??, z=??) --- Coordinates from the map
    else 
         doPlayerSendTextMessage(cid,21,"You are not using the correct item!")
    return true
end

So you dont have to put if item.itemid == xxxx or item.uid, etc...
Then you can set that at actions.xml. Hope I helped.

fail script is fail
 
Back
Top