• 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 Second Promotion Action

ftsystem

Member
Joined
Feb 17, 2019
Messages
19
Reaction score
5
Can someone help me to put a magic effect when i click on the item?
Thanks 😘


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if(item.itemid == 39186) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")

end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You are now promoted.")
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Congratulations! You are now promoted.")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)

return TRUE

end
 
Can someone help me to put a magic effect when i click on the item?
Thanks 😘


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

if(item.itemid == 39186) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")

end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You are now promoted.")
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Congratulations! You are now promoted.")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)

return TRUE

end
Place under
Code:
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
This:
Code:
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)
 
I believe it didnt work because of this error?

Code:
2022-06-02 22:07:30 -  Lua Script Error: [Action Interface]
2022-06-02 22:07:30 -  data/actions/scripts/Customs/promote2.lua:onUse
2022-06-02 22:07:30 -  data/actions/scripts/Customs/promote2.lua:7: attempt to index global 'player' (a nil value)
2022-06-02 22:07:30 -  stack traceback:
2022-06-02 22:07:30 -   [C]: in function '__index'
2022-06-02 22:07:30 -   data/actions/scripts/Customs/promote2.lua:7: in function <data/actions/scripts/Customs/promote2.lua:1>
 
I believe it didnt work because of this error?

Code:
2022-06-02 22:07:30 -  Lua Script Error: [Action Interface]
2022-06-02 22:07:30 -  data/actions/scripts/Customs/promote2.lua:onUse
2022-06-02 22:07:30 -  data/actions/scripts/Customs/promote2.lua:7: attempt to index global 'player' (a nil value)
2022-06-02 22:07:30 -  stack traceback:
2022-06-02 22:07:30 -   [C]: in function '__index'
2022-06-02 22:07:30 -   data/actions/scripts/Customs/promote2.lua:7: in function <data/actions/scripts/Customs/promote2.lua:1>
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if(item.itemid == 39186) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You are now promoted.")
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Congratulations! You are now promoted.")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)
return TRUE
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if(item.itemid == 39186) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've been promoted! Congratulations!")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You are now promoted.")
player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Congratulations! You are now promoted.")
player:getPosition():sendMagicEffect(CONST_ME_PURPLEENERGY)
return TRUE
end

Wondrous! Thanks!
 
Back
Top