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

Effect on player

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
743
Solutions
5
Reaction score
200
Location
Pr0land
GitHub
Erexo
Hello,
i wanna make, when player have stroage value 2319 == 1, then every 3sec set on player magic effect "CONST_ME_POFF"
 
globalevent (interval 3 secs).
LUA:
for _, player in ipairs(getplayersonline())
    if(getPlayerStorageValue(player, 2319) == 1) then
        doPlayeSendMagicEffect(player, CONST_ME_POFF) --I'm not sure about this function, u should do it urselfs
    end
end
 
globalevent (interval 3 secs).
LUA:
for _, player in ipairs(getplayersonline())
    if(getPlayerStorageValue(player, 2319) == 1) then
        doPlayeSendMagicEffect(player, CONST_ME_POFF) --I'm not sure about this function, u should do it urselfs
    end
end

Almost.

Just few changes to perform:
getplayersonline -> getPlayersOnline
doPlayeSendMagicEffect(player, CONST_ME_POFF) -> doSendMagicEffect(getPlayerPos(cid), CONST_ME_POFF)
 
Almost.

Just few changes to perform:
getplayersonline -> getPlayersOnline
doPlayeSendMagicEffect(player, CONST_ME_POFF) -> doSendMagicEffect(getPlayerPos(cid), CONST_ME_POFF)
omg i was writing it in fast reply box in hope that he will make 'small details' by himselfs...

@author
maybe small rep for wasting 45 sec of my life, huh?
 
omg i was writing it in fast reply box in hope that he will make 'small details' by himselfs...

@author
maybe small rep for wasting 45 sec of my life, huh?

Those small details could not be such trivial for the thread author as they're for you (not saying nothing wrong about author tho), but thats just why I pointed it out.
 
Last edited:
wouldnt it be better to have the effect happening in each player onThink event individually?
I say this because if it is triggered on the own player onThink, all the effects wouldnt happen at same time, they would be spreaded out, which would reduce the lag caused by going thru the loop every 3 seconds, like, if it has lots of players online, it'll lag every 3 seconds, if the effects happen on the player own onThink, they'd be spreaded out depending on when they login, which would in the long run reduce the lag
 
Even if there are like 400 players online it wont cause lagg. It is just sending an effect..
Also onThink creaturescript is executed every <1 second and the globalevent only every 3 secs then.
 
can't you also set the onThink to happen in a different interval like globalevent?

I dislike using cycles when they aren't needed or when I don't know an approximate size, which is why I probably would never do it thru a global event, but its just my opinion :P
 
Doesnt work :F

Error:

Code:
[Warning - GlobalEvents::configureEvent] Duplicate registered globalevent with name: control
[Error - LuaScriptInterface::loadFile] data/globalevents/scripts/killspre.lua:2: 'do' expected near 'if'
[Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/killspre.lua)
data/globalevents/scripts/killspre.lua:2: 'do' expected near 'if'
 
Code:
for _, player in in pairs(getPlayersOnline()) [B]do[/B]
    if getPlayerStorageValue(player, 2319) == 1 then
        doPlayeSendMagicEffect(getThingPos(player), CONST_ME_POFF) 
    end
end
 
LUA:
for _, player in pairs(getPlayersOnline()) do
    if getPlayerStorageValue(player, 2319) == 1 then
        doPlayeSendMagicEffect(getThingPos(player), CONST_ME_POFF) 
    end
end
 
Back
Top