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

!promote via talkactions...

ricotjeh

New Member
Joined
Apr 21, 2009
Messages
45
Reaction score
0
Well ive been thinking to be able to let players promote theirselves with the command !promote...

with this reason that my promote npc doesnt work xD

so i started trying some Lua functions and it got pretty fluently.

these are my results but seems it has some errors, and i cant figure out what they are...

Can someone help me?

Code:
function onSay(cid, words, param)


vocation = getPromotedVocation(cid)

	if doPlayerRemoveMoney(cid, 20000) == TRUE 
							
	
			and getPlayerVocation(cid) == 1 
			
				then
				
	 
	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are now Promoted.")

		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerSetVocation(cid,5)

	end
	
			

		and getPlayerVocation(cid) == 2

				then

	
				
	 
	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are now Promoted.")

		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerSetVocation(cid,6)

	end


		and getPlayerVocation(cid) == 3



				then
				
	 
	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are now Promoted.")

		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerSetVocation(cid,7)

	end



		and getPlayerVocation(cid) == 4




				then
				
	 
	
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are now Promoted.")

		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
		doPlayerSetVocation(cid,8)

	end
			
			else
	doPlayerSendCancel(cid, "You Alredy are promoted.")
	
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)


		end	
		else




		doPlayerSendCancel(cid, "You don't have enough money, Promotin costs 20k!.")
	
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)

		end


		return TRUE

	end
 
Nice tabbed script :)

Maybe mine work :(?

made it fast

PHP:
function onSay(cid, words, param)

for i = 1, 4 do
if getPlayerVocation(cid, i) and getPlayerLevel(cid) >= 20 then
if doPlayerRemoveMoney(cid, 20000) == TRUE then
	doPlayerSetVocation(getPlayerVocation(cid) +4)
	doPlayerSendTextMessage(cid, 22, "You are now promoted")
	doSendMagicEffect(cid, 37)
elseif getPlayerVocation(cid) == i and getPlayerLevel(cid) <= 20 then
	doPlayerSendTextMessage(cid, 22, "You don\'t have enough level.")
elseif  getPlayerVocation(cid) == i and getPlayerLevel(cid) >= 20 then
if doPlayerRemoveMoney(cid, 20000) == FALSE then
	doPlayerSendTextMessage(cid, 22, "You dont have enough money"
						end
					end
				end
			end
		end
	return TRUE
end
 
Last edited:
I fixed up Zonet's a bit.
Try this one instead:
PHP:
function onSay(cid, words, param)

for i = 1, 4 do
if getPlayerVocation(cid) == i and getPlayerLevel(cid) >= 20 then
if doPlayerRemoveMoney(cid, 20000) == TRUE then
    doPlayerSetVocation(getPlayerVocation(cid) +4)
    doPlayerSendTextMessage(cid, 22, "You are now promoted")
    doSendMagicEffect(cid, 37)
elseif doPlayerRemoveMoney(cid, 20000) == FALSE then
    doPlayerSendTextMessage(cid, 22, "You dont have enough money")
	end
elseif getPlayerVocation(cid) == i and getPlayerLevel(cid) <= 20 then
    doPlayerSendTextMessage(cid, 22, "You don\'t have enough level.")
elseif getPlayerVocation(cid) != i then
    doPlayerSendTextMessage(cid, 22, "You are already promoted.")
			end
        end
    return TRUE
end
 
And i fixed yours :)

PHP:
function onSay(cid, words, param)

for i = 1, 4 do
if getPlayerVocation(cid) == i and getPlayerLevel(cid) >= 20 then
if doPlayerRemoveMoney(cid, 20000) == TRUE then
    doPlayerSetVocation(getPlayerVocation(cid) +4)
    doPlayerSendTextMessage(cid, 22, "You are now promoted")
    doSendMagicEffect(cid, 37)
elseif doPlayerRemoveMoney(cid, 20000) == FALSE then
    doPlayerSendTextMessage(cid, 22, "You dont have enough money")
    end
elseif getPlayerVocation(cid) == i and getPlayerLevel(cid) <= 20 then
    doPlayerSendTextMessage(cid, 22, "You don\'t have enough level.")
elseif getPlayerVocation(cid) ~= i then
    doPlayerSendTextMessage(cid, 22, "You are already promoted.")
            end
        end
    return TRUE
end

use ~= instead of != lol.
 
Thanks Guys all added rep :)
All of the scripts worked and helped me out,
Now i have to figure out which one to use xD

Again, thanks for helping :)
 
PHP:
local config = {lvl = 20, money = 20000}

function onSay(cid, words, param)
	if(getPlayerPromotionLevel(cid) >= 1) then
		doPlayerSendCancel(cid, "You don\'t need a promotion.")
	elseif(getPlayerLevel(cid) < config.lvl) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need level " .. config.lvl .." .")
	elseif(doPlayerRemoveMoney(cid, config.money) ~= TRUE) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. config.money .. " gp to be promoted!")
	else
		setPlayerPromotionLevel(cid, 1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your new vocation:" .. getVocationInfo(getPlayerVocation(cid)).name .. ".")
	end
	return TRUE
end
 
Back
Top