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

sleepy script needed

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Reaction score
2
I want a script that transform a person to a dead human when they use /afk on and abow them text should blink Zzzz

please ? :)
 
This is the afk.lua
Code:
local time = 3 -- Seconds
local say_events = {}
local function SayText(cid)
    if isPlayer(cid) == TRUE then
         if say_events[getPlayerGUID(cid)] ~= nil then
             if isPlayer(cid) == TRUE then
                 doSendAnimatedText(getPlayerPosition(cid),"Zzzz", math.random(01,255))
             end
             say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid)       
         end                                                       
    end
    return TRUE
end

local storage = 38417
function onSay(cid, words, param, channel)
local afkCheck = getPlayerStorageValue(cid, storage)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
    return TRUE
    end
     if (param == "on") then
        if (afkCheck == -1) then
            if (isPlayer(cid) == TRUE) then
                doSendAnimatedText(getPlayerPosition(cid),"AFK", math.random(01,255))
            end
            say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You are now AFK.")
            doCreatureSetNoMove(cid, true)
            setPlayerStorageValue(cid, storage, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already AFK.")
        end
     elseif (param == "off") then
        stopEvent(say_events[getPlayerGUID(cid)])
        say_events[getPlayerGUID(cid)] = nil
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Welcome Back!")
        doCreatureSetNoMove(cid, false)
        setPlayerStorageValue(cid, storage, -1)
    end
    return TRUE
end
 
LUA:
local time = 3 -- Seconds
local t = {}

local function SayText(cid)
	if isPlayer(cid) then
		local p = getThingPos(cid)
		doSendAnimatedText(p, 'Zzzz', math.random(255))
		doSendMagicEffect(p, CONST_ME_SLEEP)
		t[cid] = addEvent(SayText, time * 1000 / 2, cid)
	else
		t[cid] = nil
	end
end

function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Command param required.')
	elseif param == 'on' then
		if not t[cid] then
			local p = getThingPos(cid)
			doSendAnimatedText(p, 'AFK', math.random(255))
			doSendMagicEffect(p, CONST_ME_SLEEP)
			t[cid] = addEvent(SayText, time * 1000, cid)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'You are now AFK.')
			doCreatureSetNoMove(cid, true)
			doSetItemOutfit(cid, getPlayerSex(cid) == 0 and 3065 or 3058, -1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are already AFK.')
		end
	elseif param == 'off' then
		if t[cid] then
			stopEvent(t[cid])
			t[cid] = nil
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'Welcome Back!')
			doCreatureSetNoMove(cid, false)
			doRemoveCondition(cid, CONDITION_OUTFIT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are not AFK.')
		end
	end
	return true
end
 
Back
Top