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

Addon

Aardappel

Learning LUA
Joined
Dec 24, 2007
Messages
145
Reaction score
0
Why does this not work he does nothing and i don't get the addons

Code:
function onUse(cid, item, frompos, item2, topos)

if itemuid == 3758 then
	doPlayerAddAddon(cid, 136, 1)
	doPlayerAddAddon(cid, 136, 2)
	doPlayerAddAddon(cid, 128, 1)
	doPlayerAddAddon(cid, 128, 2)
        doPlayerSendTextMessage(cid,22,"Congratulations u found Citizen Outfit!")

end
return TRUE

end
 
[Error - Action Interface]
[02/06/2010 19:08:39] data/actions/scripts/addons/citizen addon.lua:eek:nUse
[02/06/2010 19:08:40] Description:
[02/06/2010 19:08:40] data/actions/scripts/addons/citizen addon.lua:4: attempt to call global 'doPlayerAddAddon' (a nil value)
[02/06/2010 19:08:40] stack traceback:
[02/06/2010 19:08:40] data/actions/scripts/addons/citizen addon.lua:4: in function <data/actions/scripts/addons/citizen addon.lua:1>

now i getting this error
 
np
next time post @ Requests&Support
This section is only for releases

it's so obvious that you are using a bad spelled function
which TFS do you have, 0.3 or 0.2?
 
*0.3.6pl1
Lua Code:
doPlayerAddOutfit(cid,looktype, addons)
doPlayerAddAddons(cid, addon)

addons
=====
0 = no addons
1 = 1st addon (only)
2 = 2nd addon (only)
3 = both 1st and 2nd addons

i think it works this way...
actions.xml
Lua:
<action uniqueid="3758" script="addons.lua"/>

addons.lua
Lua:
function onUse(cid, item, frompos, item2, topos)
    doPlayerAddOutfit(cid, 136, 3)
    doPlayerAddOutfit(cid, 128, 3)
    doPlayerSendTextMessage(cid, 22,"Congratulations, you have found the Citizen Outfit!")
return true
end


 
Aha thanks rep++ for you

but i got another questions about a hole different thing look:

If i loggin on my god account console won't give errors
'but if i loggin on a normal char the console is spamming this error:
Code:
[02/06/2010 19:22:21] [Error - CreatureScript Interface] 
[02/06/2010 19:22:21] data/creaturescripts/scripts/idle.lua:onThink
[02/06/2010 19:22:22] Description: 
[02/06/2010 19:22:22] data/creaturescripts/scripts/idle.lua:14: attempt to compare number with nil
[02/06/2010 19:22:22] stack traceback:
[02/06/2010 19:22:22] 	data/creaturescripts/scripts/idle.lua:14: in function <data/creaturescripts/scripts/idle.lua:6>

i'm a newbie scripter that's why i don't understand xd
 
Oh yeh i'm sorry:p

Code:
local config = {
        idleWarning = getConfigValue('idleWarningTime'),
        idleKick = getConfigValue('idleKickTime')
}

function onThink(cid, interval)
        if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
                getPlayerCustomFlagValue(cid, PlayerCustomFlag_AllowIdle)) then
                return true
        end

        local idleTime = getPlayerIdleTime(cid) + interval
        doPlayerSetIdleTime(cid, idleTime)
        if(config.idleKick > 0 and idleTime > config.idleKick) then
                doRemoveCreature(cid)
        elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
                local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
                if(config.idleKick > 0) then
                        message = message .. ", you will be disconnected in "
                        local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
                        if(diff > 1) then
                                message = message .. diff .. " minutes"
                        else
                                message = message .. "one minute"
                        end

                        message = message .. " if you are still idle"
                end

                doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
        end

        return true
end
 
is the script registered @ creaturescripts/scripts/login.lua?? registerCreatureEvent(cid, "Idle")
Lua:
local config = {
    idleWarning = getConfigValue('idleWarningTime'),
    idleKick = getConfigValue('idleKickTime')
}

function onThink(cid, interval)
    if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
        getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
        return true
    end

    local idleTime = getPlayerIdleTime(cid) + interval
    doPlayerSetIdleTime(cid, idleTime)
    if(config.idleKick > 0 and idleTime > config.idleKick) then
        doRemoveCreature(cid)
    elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
        local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
        if(config.idleKick > 0) then
            message = message .. ", you will be disconnected in "
            local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
            if(diff > 1) then
                message = message .. diff .. " minutes"
            else
                message = message .. "one minute"
            end

            message = message .. " if you are still idle"
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
    end

    return true
end
 
Back
Top