if getPlayerPremiumDays(cid) >= 1 then
if getPlayerPromotionLevel(cid) < 1 then
doPlayerSetPromotionLevel(cid, 1)
doSendMagicEffect(getCreaturePosition(cid),30)
doPlayerSendTextMessage(cid,22,"You have been promoted!")
end
end
local t = {
[1] = {"You are now a master sorcerer",5},
[2] = {"You are now an elder druid",6},
[3] = {"You are now a royal paladin",7},
[4] = {"You are now an elite knight",8}
}
function onLogin(cid)
ppos = getPlayerPosition(cid)
local v = t[getPlayerVocation(cid)]
if t then
if getPremiumDays >= 0 then
doPlayerSetVocation(cid,v[2])
doSendMagicEffect(ppos,5)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,v[1])
setPlayerStorageValue(cid,7000,1)
elseif getPlayerStorageValue(cid,7000) > 0 then
doPlayerSendCancel(cid,"You have already been promoted")
end
return true
end
end
local t = {
[1] = {"You are now a master sorcerer",5},
[2] = {"You are now an elder druid",6},
[3] = {"You are now a royal paladin",7},
[4] = {"You are now an elite knight",8}
}
function onSay(cid, words, param)
ppos = getPlayerPosition(cid)
local v = t[getPlayerVocation(cid)]
if t then
if doPlayerRemoveMoney(cid,20000) then
if getPlayerStorageValue(cid,7000) < 1 then
doPlayerSetVocation(cid,v[2])
doSendMagicEffect(ppos,5)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,v[1])
setPlayerStorageValue(cid,7000,1)
else
doPlayerSendCancel(cid, "You have already been promoted")
end
else
doPlayerSendCancel(cid, "You do not have enough money")
end
return true
end
end
<talkaction words="!promotion" event="script" value="promote.lua"/>
local cost = 20000
local level = 20
function onSay(cid, words, param, channel)
if getPlayerPromotionLevel(cid) == 1 then
return doPlayerSendCancel(cid, 'You are already promoted.')
end
if getPlayerLevel(cid) < level then
return doPlayerSendCancel(cid, 'You must be at least level 20 in order to be promoted.')
end
if doPlayerRemoveMoney(cid, cost) then
doPlayerSetPromotionLevel(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have just been promoted')
doSendMagicEffect(getThingPos(cid), math.random(28,30))
doPlayerSave(cid)
else
return doPlayerSendCancel(cid, 'You must need '..cost..' gps in order to be promoted.')
end
return true
end
<talkaction words="!promotion" event="script" value="promo.lua"/>
@Up: That scripts mine...
And it has a login function, it must be onSay.
Lol, and it doesnt even check level nor money..
EDIT: This should work
data/talkactions/scripts/promote.lua
Lua:local t = { [1] = {"You are now a master sorcerer",5}, [2] = {"You are now an elder druid",6}, [3] = {"You are now a royal paladin",7}, [4] = {"You are now an elite knight",8} } function onSay(cid, words, param) ppos = getPlayerPosition(cid) local v = t[getPlayerVocation(cid)] if t then if doPlayerRemoveMoney(cid,20000) then if getPlayerStorageValue(cid,7000) < 1 then doPlayerSetVocation(cid,v[2]) doSendMagicEffect(ppos,5) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,v[1]) setPlayerStorageValue(cid,7000,1) else doPlayerSendCancel(cid, "You have already been promoted") end else doPlayerSendCancel(cid, "You do not have enough money") end return true end end
data/talkactions/talkactions.xml
XML:<talkaction words="!promotion" event="script" value="promote.lua"/>
Why wouldnt you help him then? :S