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

[Talkaction] Choose vocation

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hello,

I'm starting to script an go to mainland script, but now when I'm at the part to chose the vocation, it can't get the player where I need to get the storage value of :blink:
ALSO, only mind the arganoth part, icarus is not done.

Code:
[19/07/2009 15:28:11] luaGetPlayerStorageValue(). Player not found

Here's the script:
PHP:
//Arganoth//
local argpos = {x = 1333, y = 984, z = 7} //Town Temple postion //town 1
//Icarus//
local icapos = {x = 1323, y = 702, z = 7} //Town Temple Postion //town 2

function onSay(cid, words, param)
	if param == 'arganoth' then //town name
		if getPlayerLevel(cid) >= 8 then //Required LEvel
			if getPlayerStorageValue(cid, 123123) == -1 then //Storage Value
				doPlayerSendTextMessage(cid,4,"You may now choose a vocation! type !main 'vocation'") //Message when done
				setPlayerStorageValue(cid, 123123, 1) //prevention from multiple times choosing vocation and going to main
				setPlayerStorageValue(cid, 123124, 1) //turn on the ability to choose vocation
			elseif getPlayerStorageValue(cid, 123124, 1) == 1 then //Vaction storage value
				if param == 'sorcerer' then //sorcerer
					doPlayerSetTown = 2 //town ID
					doTeleportThing(cid, argpos) // teleports to argpos
					doPlayerSetVocation(cid,1) // Sorcerer
					doPlayerSendTextMessage(cid,4,"You are now one of the mighty sorcerer's of Arganoth!") // Succeed message
					setPlayerStorageValue(cid, 123123, 2) // prevention from going to main more as once
					setPlayerStorageValue(cid, 123124, 2) // Prevention from choosing vocations twice
				elseif param == 'druid' then // druid
					doPlayersetTown = 2 // town ID //should be the same as the above
					doTeleportThing(cid, argpos) // teleports to argpos
					doPlayerSetVocation(cid,2) // druid
					doPlayerSendTextMessage(cid,4,"You are now an intelligent druid of Arganoth!") // succeed message
					setPlayerStorageValue(cid, 123123, 2) // prevention from going to main more as once
					setPlayerStorageValue(cid, 123124, 2) // Prevention from choosing vocations twice
				elseif param == 'paladin' then // paladin
					doPlayerSetTown = 2 // town ID
					doTeleportThing(cid, argpos) // argpos
					doPlayerSetVocation(cid,3) // paladin
					doPlayerSendTextMessage(cid,4,"You are now a stratigic paladin of Arganoth!") // succeed message
					setPlayerStorageValue(cid, 123123, 2) // prevention from going to main more as once
					setPlayerStorageValue(cid, 123124, 2) // Prevention from choosing vocations twice
				elseif param == 'knight' then // knight
					doPlayerSetTown = 2 // town ID
					doTeleportThing(cid,argpos) // argpos
					doPlayerSetVocation(cid,4) // Knight
					doPlayerSendTextMessage(cid,4,"You are now one of the brutal knights of Arganoth!") // succeed message
					setPlayerStorageValue(cid, 123123, 2) // prevention from going to main more as once
					setPlayerStorageValue(cid, 123124, 2) // Prevention from choosing vocations twice
				end
				return TRUE
		elseif getPlayerStorageValue(cid, 123123) == 1 then // you need to choose a vocation
			doPlayerSendTextMessage(cid,4,"You need to choose a vocation!")
			doPlayerSendCancel(cid,'')
		elseif getPlayerStorageValue(cid, 123123) == 2 then
			doPlayerSendTextMessage(cid,4,"You need to be level 8 to go to main!") // you are in main
			doPlayerSendCancel(cid,'')
		end
		return TRUE
	elseif param == 'icarus' then
		if getPlayerLevel(cid) >= 8 then
			if getPlayerStorageValue(cid, 123123) == -1 then
				doTeleportThing(cid, icapos)
				doPlayerSendTextMessage(cid,4,"You are now a citizen of Icarus!")
				doPlayerSetTown(cid, 3)
				setPlayerStorageValue(cid, 123123, 1)
			else
			doPlayerSendTextMessage(cid,4,"You are already in main!")
			doPlayerSendCancel(cid,'')
			end
			return TRUE
		else
		doPlayerSendTextMessage(cid,4,"You need level 8 to go to icarus.")
		doPlayerSendCancel(cid,'')
		end
		return TRUE
	end
	return FALSE
end
end

+rep if you fix it. :thumbup:

thanks,
unknown666
 
Last edited:
Lua:
--Arganoth-- 
local argpos = {

	x = 1333, 
	y = 984, 
	z = 7
}
--Icarus--
local icapos = {

	x = 1323, 
	y = 702, 
	z = 7
}

function onSay(cid, words, param)
	local town = nil
	local voc = nil
	local text = nil
	local pos = nil
	local parametres = string.explode(param, ",")
	if parametres[1] == "sorcerer" then
		voc = 1
		text = "You are now one of the mighty sorcerer's of Arganoth!"
	elseif parametres[1] == "druid" then
		voc = 2
		text = "You are now an intelligent druid of Arganoth!"
	elseif parametres[1] == "paladin" then
		voc = 3
		text = "You are now a stratigic paladin of Arganoth!"
	elseif parametres[1] == "knight" then
		voc = 4
		text = "You are now one of the brutal knights of Arganoth!"
	elseif parametres[1] == nil  or parametres[1] then
		doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
	end
	if parametres[2] ~= nil then
		if parametres[2] = "arganoth" then
			pos = arganoth
			town = 2
			town_text = "You are now a citizen of Arganoth!"
		elseif parametres[2] = "icarus" then
			pos = icarus
			town = 3
			town_text = "You are now a citizen of Icarus!"
		end
	else
		doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
	end
	if getPlayerLevel(cid) >= 8 then
		if getPlayerStorageValue(cid, 12345) == -1 then
			if town ~= nil and pos ~= nil and text ~= nil and town_text ~= nil and voc ~= nil then
				doTeleportThing(cid, pos)
				doPlayerSetVocation(cid,voc)
				doPlayerSendTextMessage(cid,4,text)
				doPlayerSendTextMessage(cid,4,town_text)
				doPlayerSetTown(cid, town)
				setPlayerStorageValue(cid, 12345, 1)
			else
				doPlayerSendTextMessage(cid,4,"You are already in main!")
			end
		else
			doPlayerSendTextMessage(cid,4,"You need level 8 to go to icarus.")
		end
	end
	return TRUE
end

Not tested.

I hope it work :thumbup:.

Regards,
Shawak
 
It keeps telling me 'then' is expected on line 38, however there's then

Code:
 data/talkactions/scripts/main/main.lua:38: 'then' expected near '='

PHP:
        if parametres[2] ~= nil then //37
                if parametres[2] = "arganoth" then //line 38
                        pos = arganoth
                        town = 2
                        town_text = "You are now a citizen of Arganoth!"
                elseif parametres[2] = "icarus" then
                        pos = icarus
                        town = 3
                        town_text = "You are now a citizen of Icarus!"
                end

also +rep
 
Lua:
--Arganoth--
local argpos = {

        x = 1333,
        y = 984,
        z = 7
}
--Icarus--
local icapos = {

        x = 1323,
        y = 702,
        z = 7
}

function onSay(cid, words, param)
        local town = nil
        local voc = nil
        local text = nil
        local pos = nil
        local parametres = string.explode(param, ",")
        if parametres[1] == "sorcerer" then
                voc = 1
                text = "You are now one of the mighty sorcerer's of Arganoth!"
        elseif parametres[1] == "druid" then
                voc = 2
                text = "You are now an intelligent druid of Arganoth!"
        elseif parametres[1] == "paladin" then
                voc = 3
                text = "You are now a stratigic paladin of Arganoth!"
        elseif parametres[1] == "knight" then
                voc = 4
                text = "You are now one of the brutal knights of Arganoth!"
        elseif parametres[1] == nil  or parametres[1] then
                doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
        end
        if parametres[2] ~= nil then
                if parametres[2] == "arganoth" then
                        pos = arganoth
                        town = 2
                        town_text = "You are now a citizen of Arganoth!"
                elseif parametres[2] == "icarus" then
                        pos = icarus
                        town = 3
                        town_text = "You are now a citizen of Icarus!"
                end
        else
                doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
        end
        if getPlayerLevel(cid) >= 8 then
                if getPlayerStorageValue(cid, 12345) == -1 then
                        if town ~= nil and pos ~= nil and text ~= nil and town_text ~= nil and voc ~= nil then
                                doTeleportThing(cid, pos)
                                doPlayerSetVocation(cid,voc)
                                doPlayerSendTextMessage(cid,4,text)
                                doPlayerSendTextMessage(cid,4,town_text)
                                doPlayerSetTown(cid, town)
                                setPlayerStorageValue(cid, 12345, 1)
                        else
                                doPlayerSendTextMessage(cid,4,"You are already in main!")
                        end
                else
                        doPlayerSendTextMessage(cid,4,"You need level 8 to go to icarus.")
                end
        end
        return TRUE
end

Fixed.

Regards,
Shawak
 
Yeah, your character already have the storage, change the storage value.

Lua:
local storage = 123457

--Arganoth--
local argpos = {

        x = 1333,
        y = 984,
        z = 7
}
--Icarus--
local icapos = {

        x = 1323,
        y = 702,
        z = 7
}

function onSay(cid, words, param)
        local town = nil
        local voc = nil
        local text = nil
        local pos = nil
        local parametres = string.explode(param, ",")
        if parametres[1] == "sorcerer" then
                voc = 1
                text = "You are now one of the mighty sorcerer's of Arganoth!"
        elseif parametres[1] == "druid" then
                voc = 2
                text = "You are now an intelligent druid of Arganoth!"
        elseif parametres[1] == "paladin" then
                voc = 3
                text = "You are now a stratigic paladin of Arganoth!"
        elseif parametres[1] == "knight" then
                voc = 4
                text = "You are now one of the brutal knights of Arganoth!"
        elseif parametres[1] == nil  or parametres[1] then
                doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
        end
        if parametres[2] ~= nil then
                if parametres[2] == "arganoth" then
                        pos = arganoth
                        town = 2
                        town_text = "You are now a citizen of Arganoth!"
                elseif parametres[2] == "icarus" then
                        pos = icarus
                        town = 3
                        town_text = "You are now a citizen of Icarus!"
                end
        else
                doPlayerSendTextMessage(cid,4,"You have to write !main VOCATION,LAND.")
        end
        if getPlayerLevel(cid) >= 8 then
                if getPlayerStorageValue(cid, storage) == -1 then
                        if town ~= nil and pos ~= nil and text ~= nil and town_text ~= nil and voc ~= nil then
                                doTeleportThing(cid, pos)
                                doPlayerSetVocation(cid,voc)
                                doPlayerSendTextMessage(cid,4,text)
                                doPlayerSendTextMessage(cid,4,town_text)
                                doPlayerSetTown(cid, town)
                                setPlayerStorageValue(cid, storage, 1)
                        else
                                doPlayerSendTextMessage(cid,4,"You are already in main!")
                        end
                else
                        doPlayerSendTextMessage(cid,4,"You need level 8 to go to icarus.")
                end
        end
        return TRUE
end

Regards,
Shawak
 
Back
Top