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

Solved Premium player shines when log

1268995

Member
Joined
Sep 9, 2010
Messages
422
Reaction score
13
I need help in a script!

I want to my premium players shine when log in.. I mean, i want that all other players know that some players are premium.

I taked a lot of parts of a lot of other script and maded that:

Code:
local efeito1 = 30 -- efect that will stay for 30 minutes
local timeEffect = 1801 -- efect that will appear in player, 31 = 30 secunds.Always put 1 second more


function onLogin(cid)
      function effect()
         if isPlayer(cid) then
            local pos = getCreaturePosition(cid)
            doSendMagicEffect(pos, efeito1)
         end
      
            a = 1
  while a ~= timeEffect do
        addEvent(effect, a * 1000)
          a = a + 1
  end
   
end
return true
   end

For sure this code do not work, i have no idea about that function while a =1 (lol)... i just make a fusion of script and this are not working out.

Edit: i putted 2 functions togheter (onlogin and effect)... it's possible?

Please help!
 
Last edited:
Maybe this will help to understand more how to use functions.
https://otland.net/threads/bridge-lever-error.232338/#post-2239994

Code:
local function effect(cid, a)
     if isPlayer(cid) then
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
         if a ~= timeEffect then
             a = a + 1
             addEvent(effect, 1000, cid, a)  
         end 
     end
end

Code:
effect(cid, 1)

Next time post your server version.
 
Last edited:
Maybe this will help to understand more how to use functions.
https://otland.net/threads/bridge-lever-error.232338/#post-2239994

Code:
local function effect(cid, a)
     if isPlayer(cid) then
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
     end
     if a ~= timeEffect then
         a = a + 1
         addEvent(effect, 1000, cid, a)
     end
end

Code:
effect(cid, 1)

Next time post your server version.

Nope, didn't worked.. I want to remeber that i need that function on login... i mean, when premium player log in, some light or firework keeps infinitly shining until him log out..
VERSION 8.60
my code:

Code:
local efeito1 = 30 -- efeito que ficara com o char por meia hora
local timeEffect = 1801 -- tempo em segundos que o efeito vai apareceer no player, 31 = 30 segundos. sempre coloque 1 segundo a mais.


function onLogin(cid)
local function effect(cid, a)
     if isPlayer(cid) then
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
     end
     if a ~= timeEffect then
         a = a + 1
         addEvent(effect, 1000, cid, a)
     end

   
end
return true
   end
 
Did you read the post I linked? If things are not clear enough, feel free to ask questions.
You have to add the function, for example above function onLogin. Then call the function.
Code:
local timeEffect = 1801 -- tempo em segundos que o efeito vai apareceer no player, 31 = 30 segundos. sempre coloque 1 segundo a mais.

local function effect(cid, a)
     if not isPlayer(cid) then
         return true
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
     if a ~= timeEffect then
         a = a + 1
         addEvent(effect, 1000, cid, a)   
     end  
end

function onLogin(cid)
     effect(cid, 1)
     return true
end
 
I read what u said @Limos , but checking the code u post, i would NEVER get even CLOSER of code u maded.

Worked, thank you.

Edit: @Limos, in script case, the shine light will be there for:
local timeEffect = 1801 (seconds)>

Is there a way to make this light forever until him log out?
 
If you don't want it for a certain time, you can just remove that part, check for not isPlayer(cid) and then return true.
With return you make it stop, so it will ignore the rest under it if the player is offline.
Code:
local function effect(cid)
     if not isPlayer(cid) then
         return true
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE)
     addEvent(effect, 1000, cid)
end

function onLogin(cid)
     effect(cid)
     return true
end
 
Back
Top