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

New items command

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Reaction score
2
Hey!

I have alot of diffrents new items on my server so i would like a command like !items and then i can see name of all new items and there id nr..
its an easy script I know but I have started it like this:

LUA:
Lua:
function onSay(cid, words, param)
doPlayerPopupFYI(cid, 'Item list:  Solar axe:8925    Enforced Sword:8932    Hammer of prophecy:7450')
end

But I would like it to more of a list so how should I do if i like a row breake or a new line?
If Í have it like I have it now its going to so loong
 
Last edited by a moderator:
Add this: \n just after the 7450, is like a enter. Something like this:

Code:
Line1\n Line2\n Line3\n Line4\n

Lua:
function onSay(cid, words, param)
doPlayerPopupFYI(cid, 'Item list:\n  Solar axe:8925\n    Enforced Sword:8932\n    Hammer of prophecy:7450\n')
end
 
I tried to make command, which reading the whole items.xml file. But the client crash :p
 
I tried to make command, which reading the whole items.xml file. But the client crash :p

The length of a "FYI" message is max 1024 characters iirc. Then the client crashes or the server simply doesn't send it, not causing a crash (the latest should happen).

But if I want "!items" to not be shown i chat/screen?

This is a setting in talkactions.xml.
 
Here is maybe easier way:

xPlUR7.png


Go to items folder and create new txt file and name it: "itemsinfo"
Here is example how it could look like inside:
Magic Sword: 2400
Money: 2160

Now go to talkactions/talkactions.xml and paste this line below:
XML:
<talkaction words="!itemsinfo" access="6" event="script" value="itemsinfo.lua"/>

Now go to talkactions/scripts and create new lua and name it "itemsinfo" and paste this code below:
Lua:
function onSay(cid, words, param)      
        local cyko = io.open("data/items/itemsinfo.txt")
        local content = ""
        if(cyko) then
                content = cyko:read("*all")
                doShowTextDialog(cid,2400, "----Items ID----\n"..content..".")
                cyko:close()
                else
                doPlayerSendTextMessage(cid,27, "Missing text file, go to items folder and create new document and name it: itemsinfo.txt")
        end
	return true
end
 
Lua:
function onSay(cid, words, param)
doPlayerPopupFYI(cid, 'Item list:\n  Solar axe:8925\n    Enforced Sword:8932\n    Hammer of prophecy:7450\n')
return true
end


Yea that work! Thank you :D

- - - Updated - - -

Here is maybe easier way:

xPlUR7.png


Go to items folder and create new txt file and name it: "itemsinfo"
Here is example how it could look like inside:


Now go to talkactions/talkactions.xml and paste this line below:
XML:
<talkaction words="!itemsinfo" access="6" event="script" value="itemsinfo.lua"/>

Now go to talkactions/scripts and create new lua and name it "itemsinfo" and paste this code below:
Lua:
function onSay(cid, words, param)      
        local cyko = io.open("data/items/itemsinfo.txt")
        local content = ""
        if(cyko) then
                content = cyko:read("*all")
                doShowTextDialog(cid,2400, "----Items ID----\n"..content..".")
                cyko:close()
                else
                doPlayerSendTextMessage(cid,27, "Missing text file, go to items folder and create new document and name it: itemsinfo.txt")
        end
	return true
end

That was actually what I tried to do at first but I gave up. Thanx alot! :)
 
Back
Top