• 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 Any function like this?

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey all,

I'm wondering if there is any function, which allows you to do a bit of coding ingame.

I.e.
/lua for i = 1,#getCreatureSummons(cid) do return doPlayerAddItem(cid,2000,1) end

I'm using TFS 0.4 (rev 3884)

Thanks in advance,
unknown666
 
yes, here:
Code:
--Copyright (C) 2010 - 2011 Cykotitan <[email protected]>
--Rewritten by Fallen <[email protected]>

local function callback(cid,...)
    local t = {}
    for i = 1, #arg do
        t[i] = arg[i]
    end
    doPlayerSendTextMessage(cid,27,table.concat(t," " ));
    --no need to return anything.
end

function onSay(cid,words,param,channel)
    if not param or param == ""
    then
        doPlayerSendTextMessage(cid,27,"Not enough parameters\n");
        return false;
    end

    callback(cid,pcall(loadstring("local cid = " .. cid .. " " .. param)))
    return true
end
 
Here you got one more expanded:
command-lua.xml - tfs-mods - The Forgotten Server modifications - Google Project Hosting

It also got some custom features, like you can use some custom attributes like cid, pos. There is also displaying script execution time and table support. Check it out!

@edit
Its mod, so all you have to do is create new file in mods directory and it will work.

@edit2
Glad to hear that you liked it ;)
You can also return values you want, for example:
Code:
/return 3 + 3
/return getPlayerLevel(c("Blabla"))
/return getPlayersOnline()
 
Last edited:
Back
Top