• 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 +rep

Cloow

Active Member
Joined
May 10, 2010
Messages
1,086
Reaction score
35
Hello, i want a script wich work like this.

If a players right click on a item, he sends a "normal" text !challenge since i have a talkaction script wich works like that.

I tought it could be like this.

crappy made, just quick for show.

Code:
function onUseItem (blablabla) 
 if itemid = xxxx then
   doPlayerSendChannelMessage(cid, author, !challenge, ???, Default)]


Rep+
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doCreatureSay(cid, "!challenge")
return true
end
 
I think.. i think, there is something missing there.

Lua Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemid = xxx
doCreatureSay(cid, "!challenge")
return true
end

Right? =)
 
Eh? No theres nothing missing, why should I add
LUA:
if item.itemid == xxxx
If you state it in actions.xml?? :p
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
         doCreatureSay(cid, "!challenge")
     return true
end

Code:
if item.itemid == xxxx
is not necessary only add on actions.xml

XML:
	<action itemid="ID" event="script" value="SCRIPT.lua" />
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
         doCreatureSay(cid, "!challenge")
     return true
end

Code:
if item.itemid == xxxx
is not necessary only add on actions.xml

XML:
	<action itemid="ID" event="script" value="SCRIPT.lua" />


Oh, lol. Im such dumb..

Never tought about actions.xml..

Thanks guys, rep for you all :)
 
That's wierd, When i use the item the char says !challenge. But the script wont be executed.

When i then type !challenge, it does?
 
Look, i got a talkaction script wich execute a action that you challenge a person. I want it so, when you right click on a item. Its gonna execute same script.

So i was smart and tought, if i make item that makes the character say !challenge and the script execute.
 
Or, you can merge the talkaction script with the action script? easier xD?
Post your talkaction script if you want too.
 
Nah, i don't want to post the script here for the public. It was made by a friend for me, don't know if he would like that :(
 
Since you are donator and have 0.4 TFS you can use:
LUA:
doCreatureExecuteTalkAction(cid, "!challenge")
 
Back
Top