Superior Man
New Member
- Joined
- Mar 13, 2016
- Messages
- 39
- Reaction score
- 0
hello i need help please to do this script ...if vocation id > 5 then send effect to player every 5 second
tfs 1.2
client 10.90
tfs 1.2
client 10.90
local function loop_1(cid)
if not isPlayer(cid) then
return true
end
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SOUND_WHITE)
addEvent(loop_1, 5000, cid)
end
function onLogin(cid)
if getPlayerVocation(cid) > 5 then
addEvent(loop_1, 5000, cid)
end
return true
end
--[[
<event type="login" name="animation_for_promoted_characters" script="animation_for_promoted_characters.lua"/>
registerCreatureEvent(cid, "animation_for_promoted_characters")
]]
Here's my lua version for 0.3.7
It should be simple for someone to convert to 1.2 if they have a couple minutes.
Code:local function loop_1(cid) if not isPlayer(cid) then return true end doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SOUND_WHITE) addEvent(loop_1, 5000, cid) end function onLogin(cid) if getPlayerVocation(cid) > 5 then addEvent(loop_1, 5000, cid) end return true end --[[ <event type="login" name="animation_for_promoted_characters" script="animation_for_promoted_characters.lua"/> registerCreatureEvent(cid, "animation_for_promoted_characters") ]]
local function loop_1(player)
if not isPlayer(player) then
return true
end
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
addEvent(loop_1, 5000)
end
function onLogin(cid)
if player:getVocation() > 5 then
addEvent(loop_1, 5000)
end
return true
end
--[[
<event type="login" name="animation_for_promoted_characters" script="animation_for_promoted_characters.lua"/>
registerCreatureEvent(cid, "animation_for_promoted_characters")
]]
I'm not going to try to edit it.. but you need to pass the player argument to the loop, or it'll just error.Code:local function loop_1(player) if not isPlayer(player) then return true end player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) addEvent(loop_1, 5000) end function onLogin(cid) if player:getVocation() > 5 then addEvent(loop_1, 5000) end return true end --[[ <event type="login" name="animation_for_promoted_characters" script="animation_for_promoted_characters.lua"/> registerCreatureEvent(cid, "animation_for_promoted_characters") ]]
Try something like this
local function loop_1(cid)
local player = Player(cid)
if not player then
return true
end
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
addEvent(loop_1, 5000, player.uid)
end
function onLogin(player)
if player:getVocation() > 5 then
addEvent(loop_1, 5000, player.uid)
end
return true
end
--[[
<event type="login" name="animation_for_promoted_characters" script="animation_for_promoted_characters.lua"/>
registerCreatureEvent(cid, "animation_for_promoted_characters")
]]
ah... forgotI'm not going to try to edit it.. but you need to pass the player argument to the loop, or it'll just error.