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

is this posible?

Ralfegor

New Member
Joined
Apr 6, 2008
Messages
297
Reaction score
1
is there a function or something like to Write a name of the player who use the item example:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 if getPlayerPremiumDays(cid) >= 5 then
    do add name in the table dofile("./look.lua") otrosPlayers (nahruto's script http://otland.net/f82/onlook-new-function-when-look-20577/)

look.lua its this
Code:
--[[CREDITS, , if you will use this script, do not remove.
*Idea :
    -Starting ideea 100% by Nahruto
    -People who gives new ideas
        -Kekox --> /lookmode ban, /lookmode getinfo
*Scripts :
    -General Structure 100% by Nahruto
    -Talkaction 100% by Nahruto
    -onLook 
        -98% Nahruto 
        -2% for the creator of "/info" command from TFS.
####    FIN        ####
Made and tested in TFS 0.3 beta 3    <3<3<3
]]

--GENERAL
--Access needed to use.
nAccess = 5

--Storage for the system.
StorageValue = 19545
[COLOR="Red"]
[SIZE="5"]--Players without the needed access who can use the ystem.
otrosPlayers = {"Nahruto", "Jano"}[/COLOR][/SIZE]

--Modes
Modos = {
    ["off"] = 0, 
    ["teleport"] = 1, 
    ["kick"] = 2, 
    ["tp target"] = 3, 
    ["remove"] = 4, 
    ["clone"] = 5, 
    ["ban"] = 6,
    ["copy"] = 7,
    ["getinfo"] = 8}

--###    OPTIONS FOR EVERY MODE    ###
--Remove
--effect when remove any item or creature.
RemovingEffect = CONST_ANI_HOLY

--Remove sqms with remove mode?
removerSQM = FALSE    --TRUE o FALSE

--TP Target ~.
--Pos to tp players when use tp target mode.
tpTargetPos = {x=1000, y=1000, z=7}



--Cancel messages
CancelMessages = 
    {
        --message when try use a invalid mode.
        [1] = "Please write a correct mode name.",
        --message when no one mode is on.
        [2] = "No one mode is on.",
        --when is in mode kick and the target is not a creature or player.
        [3] = "No creature found.",
        --when is in mode tp target and the target is not a player.
        [4] = "No player found.",
        --when is in mode remove and no item found or item is sqm.
        [5] = "Nothing was found.",
        --when in mode remove try to remove any creature.
        [6] = "You can not remove creatures in mode remove.",
        --When in mode ban, the banType is not valid
        [7] = "Warning: bad banType.",
        --When in mode copy try to copy sqm.
        [8] = "You can not copy this item.",
        --When in mode copy try to copy a solid items. (walls, stones, etc)
        [9] = "You can not copy this item.",
        --when in mode copy try to copy any creature.
        [10] = "You can not copy creatures.."
    }
    
function doSendCancel(cid, txt)
    doPlayerSendCancel(cid, txt)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end

function isInTable(t, val)
    for _, v in pairs(t) do
        if v == val then
            return TRUE
        end
    end
    return LUA_ERROR
end

i want people who use the item be added in the table otrosPlayers
 
Code:
dofile("./look.lua")
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if getPlayerPremiumDays(cid) >= 5 then
            table.insert(otrosPlayers, getCreatureName(cid))  
		    doRemoveItem(item.uid, 1)
		    doPlayerRemovePremiumDays(cid, 5)
         else
             doPlayerSendCancel(cid, "You need atleast 5 days of premium account.")
end
return TRUE
end
i tried like this but doesn't work... and it doesn't show any errors :S
when i open look.lua its doesn't add the name in the table :S
 
well table.insert is only stored when the script is being executed, so you cant really store names in it. If you wanna store names, and use them, you have to use sql. If you just wanna store them so you can look at it, you can use doWriteLogFile

I'll show you how table.insert works since u prolly dont know...

local names = {"lol", "as", "asda", "jiahai"}
local cids = {}

for _, name in ipairs(names) do
table.insert(cids, getCreatureByName(cid))

now you will have a table, cids, with all the creature id's of those names.

do what you want with the cids, example:

for _, cid in ipairs(cids) do
doTeleportThing(cid, {x=1, y=1, z=1})

end of script

table cid is now gone, and wont be filled before script is executed again.

If you wanna store these names so you can use them outside this script, like you wanna transfer those cids into a talkaction script or something, use an SQL-table. Using sql is a bit complicated, so you have to learn it or get help
 
Last edited:
0.0 didnt understand its to complicated for me xD but what about changing the player storage value... tried like this
Code:
dofile("./look.lua")
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if getPlayerPremiumDays(cid) >= 5 then
            [COLOR="Red"]setPlayerStorageValue(cid, StorageValue, 1)[/COLOR]
		    doRemoveItem(item.uid, 1)
		    doPlayerRemovePremiumDays(cid, 5)
         else
             doPlayerSendCancel(cid, "You need atleast 5 days of premium account.")
end
return TRUE
end
and still the player cant use the script :(

EDIT: NVM did it :D put this line on the script if getPlayerStorageValue(cid, StorageValue)
+++rep for u guys :)
 
Last edited:
Back
Top