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

Need script onLogin

phern

alysiaots.com
Joined
Nov 2, 2008
Messages
195
Reaction score
2
Location
Poland
Hi there!
I want to make an script that is repeating some effect on player every one second.
I think the best would be onLogin function in creaturescripts, but I have always had troubles with repeating functions.

It should look something like that:
Code:
function onLogin(cid)  
 if getPlayerGroupId(cid) == 6 or getPlayerGroupId(cid) == 4 then
<repeating effect no. 14 every one second>
end
I would really appreciate help.
Thanks in advance.
 
in creaturescripts.xml add this
Lua:
<event type="login" name="effect" event="script" value="effect.lua"/>
and register it in login.lua
Lua:
registerCreatureEvent(cid, "effect")
now create effect.lua
Lua:
local function effect(cid)
    for _, name in ipairs(getOnlinePlayers()) do
        if (cid) == getPlayerByName(name) then
	doSendMagicEffect(getCreaturePosition(cid), 14)
    addEvent(effect, 1 * 1000, cid)
end
end
end

function onLogin(cid)
     if getPlayerGroupId(cid) == 6 or getPlayerGroupId(cid) == 4 then
        addEvent(effect, 1 * 1000, cid)
    end
    return TRUE
end
 
Code:
local function effect(cid)
	if isPlayer(cid) then
		doSendMagicEffect(getThingPos(cid), 14)
		addEvent(effect, 1000, cid)
	end
end

function onLogin(cid)
	if isInArray({4, 6}, getPlayerGroupId(cid)) then
		addEvent(effect, 1000, cid)
	end
	return true
end
 
Back
Top