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

Lua TFS 0.4 magic effect doesn't work?

Akira1992

New Member
Joined
Jun 8, 2025
Messages
9
Reaction score
1
LUA:
function onStepIn(cid, item, pos)
if isPlayer(cid) == TRUE then
if (item.actionid == 4040) then

doPlayerSendTextMessage(cid,19,"You are now a citizen of Thais.")
doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
doPlayerSetTown(cid,7)

end
end
end

Everything seems to work aside from the magic effect part of it and for the life of me I can't figure out why it's not showing the effect. TFS 0.4 3777
Thank you!
 
isPlayer(cid) no need check true if isPlayer(cid) then is good
doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
pos == unknow position use
local pos = getPlayerPosition(cid) and then use
doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
and before last end add return true to close ur script
LUA:
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
if (item.actionid == 4040) then

doPlayerSendTextMessage(cid,19,"You are now a citizen of Thais.")
local pos = getPlayerPosition(cid)
doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
doPlayerSetTown(cid,7)

end
end
return true
end
 
Everything seems to work aside from the magic effect part of it
@Elgenady
Already answered with probably working code, as he gets position from player getPlayerPosition(cid)
For future you should learn how to debug you own code. ex. add code to print pos and effect ID:
LUA:
function onStepIn(cid, item, pos)
  if isPlayer(cid) == TRUE then
    if (item.actionid == 4040) then
      doPlayerSendTextMessage(cid, 19, "You are now a citizen of Thais.")
      doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
      doPlayerSetTown(cid, 7)
      -- should print number 15
      print('citizen effect id', CONST_ME_HITBYFIRE)
      -- should print 'table' and some random RAM address
      print('citizen pos', pos)
      -- should print player 'x' position or Lua error or 0, if position is not set
      print('citizen pos.x', pos.x)
      -- should print player 'y' position or Lua error or 0, if position is not set
      print('citizen pos.y', pos.y)
      -- should print player 'z' position or Lua error or 0, if position is not set
      print('citizen pos.z', pos.z)
    end
  end
end
x,y,z is probably set to 0 and that's why it does not show effect.
 
Thank you for the reply, however the effect still does not show up - even changed it to CONST_ME_FIREAREA as in 000-constant.lua file
No errors in console or anything else, teleport works fine and the message "you are now a citizen of thais" shows up also.

Thank you again!
Post automatically merged:

@Elgenady
Already answered with probably working code, as he gets position from player getPlayerPosition(cid)
For future you should learn how to debug you own code. ex. add code to print pos and effect ID:
LUA:
function onStepIn(cid, item, pos)
  if isPlayer(cid) == TRUE then
    if (item.actionid == 4040) then
      doPlayerSendTextMessage(cid, 19, "You are now a citizen of Thais.")
      doSendMagicEffect(pos, CONST_ME_HITBYFIRE)
      doPlayerSetTown(cid, 7)
      -- should print number 15
      print('citizen effect id', CONST_ME_HITBYFIRE)
      -- should print 'table' and some random RAM address
      print('citizen pos', pos)
      -- should print player 'x' position or Lua error or 0, if position is not set
      print('citizen pos.x', pos.x)
      -- should print player 'y' position or Lua error or 0, if position is not set
      print('citizen pos.y', pos.y)
      -- should print player 'z' position or Lua error or 0, if position is not set
      print('citizen pos.z', pos.z)
    end
  end
end
x,y,z is probably set to 0 and that's why it does not show effect.
I've looked up different gith hubs and looked for functions and none I tried worked, still a bit of a newb to all this :p
Post automatically merged:

Also tried doSendMagicEffect({x=1120, y=1083, z=6}, CONST_ME_FIREAREA) so it's a fixed position but still the effect refuses to show. Thank you anyways!
 
Last edited:
Thank you for the reply, however the effect still does not show up - even changed it to CONST_ME_FIREAREA as in 000-constant.lua file
No errors in console or anything else, teleport works fine and the message "you are now a citizen of thais" shows up also.

Thank you again!
Post automatically merged:


I've looked up different gith hubs and looked for functions and none I tried worked, still a bit of a newb to all this :p
Post automatically merged:

Also tried doSendMagicEffect({x=1120, y=1083, z=6}, CONST_ME_FIREAREA) so it's a fixed position but still the effect refuses to show. Thank you anyways!

Thank you for the reply, however the effect still does not show up - even changed it to CONST_ME_FIREAREA as in 000-constant.lua file
No errors in console or anything else, teleport works fine and the message "you are now a citizen of thais" shows up also.

Thank you again!
Post automatically merged:


I've looked up different gith hubs and looked for functions and none I tried worked, still a bit of a newb to all this :p
Post automatically merged:

Also tried doSendMagicEffect({x=1120, y=1083, z=6}, CONST_ME_FIREAREA) so it's a fixed position but still the effect refuses to show. Thank you anyways!
you're setting this movement on a teleport, right?
maybe try adding a delay (addEvent) so the player can see it, I guess it's probably sending the effect before the player gets teleported.
 
Back
Top