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

GlobalEvent New player Town selecter (CHECK THIS!)

gigastar

Member
Joined
Jan 25, 2009
Messages
252
Reaction score
15
Cleaned it. Was high making it first time, and just messing around really. Here you go.

Code:
--------Towns----------
local sorcTown = {x = 1000, y = 1000, z = 7}
local druidTown = {x = 1000, y = 1000, z = 7}
local paladinTown = {x = 1000, y = 1000, z = 7}
local knightTown = {x = 1000, y = 1000, z = 7}
--------ITEMS----------
local sorcItems = {[helmet] = 1111, [armor] = 2222, [legs] = 3333, [boots] = 5555, [bag] = 6666, [amulet] = 7777, [ammo] = 8888}
local druidItems = {[helmet] = 1111, [armor] = 2222, [legs] = 3333, [boots] = 5555, [bag] = 6666, [amulet] = 7777, [ammo] = 8888}
local PaladinItems = {[helmet] = 1111, [armor] = 2222, [legs] = 3333, [boots] = 5555, [bag] = 6666, [amulet] = 7777, [ammo] = 8888}
local KnightItems = {[helmet] = 1111, [armor] = 2222, [legs] = 3333, [boots] = 5555, [bag] = 6666, [amulet] = 7777, [ammo] = 8888}
-------------MESSAGES----------------
local sorcMSG = "Welcome young sorcerer."
local druidMSG = "Welcome young druid."
local paladinMSG = "Welcome young paladin."
local knightMSG = "welcome young knight."
-----------MAGIC EFFECTS-------------
local sorcME = 10
local druidME = 11
local paladinME = 12
local knightME = 13
--------------------------------------


function onLogin(cid)
	if (isPlayer(cid)) and getPlayerLastLogin(cid) == 0 then
		if getPlayerVocation(cid) == 1 then
			doTeleportThing(cid, sorcTown)
			doPlayerAddItem(cid, sorcItems[helmet])
			doPlayerAddItem(cid, sorcItems[armor])
			doPlayerAddItem(cid, sorcItems[legs])
			doPlayerAddItem(cid, sorcItems[boots])
			doPlayerAddItem(cid, sorcItems[bag])
			doPlayerAddItem(cid, sorcItems[amulet])
			doPlayerAddItem(cid, sorcItems[ammo])
			doSendMagicEffect(getPlayerPostion(cid), sorcME)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, sorcMSG)
	elseif getPlayerVocation(cid) == 2 then
			doTeleportThing(cid, druidTown)
			doPlayerAddItem(cid, druidItems[helmet])
			doPlayerAddItem(cid, druidItems[armor])
			doPlayerAddItem(cid, druidItems[legs])
			doPlayerAddItem(cid, druidItems[boots])
			doPlayerAddItem(cid, druidItems[bag])
			doPlayerAddItem(cid, druidItems[amulet])
			doPlayerAddItem(cid, druidItems[ammo])
			doSendMagicEffect(getPlayerPostion(cid), druidME)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, druidMSG)
	elseif getPlayerVocation(cid) == 3 then
			doTeleportThing(cid, paladinTown)
			doPlayerAddItem(cid, paladinItems[helmet])
			doPlayerAddItem(cid, paladinItems[armor])
			doPlayerAddItem(cid, paladinItems[legs])
			doPlayerAddItem(cid, paladinItems[boots])
			doPlayerAddItem(cid, paladinItems[bag])
			doPlayerAddItem(cid, paladinItems[amulet])
			doPlayerAddItem(cid, paladinItems[ammo])
			doSendMagicEffect(getPlayerPostion(cid), paladinME)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, paladinMSG)
	elseif getPlayerVocation(cid) == 4 then
			doTeleportThing(cid, knightTown)
			doPlayerAddItem(cid, knightItems[helmet])
			doPlayerAddItem(cid, knightItems[armor])
			doPlayerAddItem(cid, knightItems[legs])
			doPlayerAddItem(cid, knightItems[boots])
			doPlayerAddItem(cid, knightItems[bag])
			doPlayerAddItem(cid, knightItems[amulet])
			doPlayerAddItem(cid, knightItems[ammo])	
			doSendMagicEffect(getPlayerPostion(cid), knightME)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, knightMSG)
end
end
return true
end
 
Last edited:
Code:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--<<-----------Script Base--------------->>
local config.scriptbase1 = true  --This tells the script to check the players town id, and then teleport sto the town he/she should go to.--
local config.scriptbase2 = false --This tells the script to check the players vocation, and then teleports them to the town he/she should go to.--
--Both cant be true!!--
--<<--------------END-------------------->>
------------TOWN NAMES---------------------
local useTownNames = true -- This means the town name will pop up under the player in animated text when it spawns him there.--
local town1 = "NOOBVILLE"
local town2 = "CRYMORE"
local town3 = "SMEERNOFF"
local town4 = "JACKHOFF"
local town5 = "ANOTHERTOWN"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--<<-------------Advanced Options---------->>
local broadcastNewPlayer = true --Broadcast to the server when a new player starts?--
local showName = true
local showTown = false
local showVoc = false
---<<--------------END-------------------->>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--<<--------------Towns/positions---------------------->>
local pos1 = {x = 1000, y = 1000, z = 1000} --sorcerer town/ first town--
local pos2 = {x = 2000, y = 2000, z = 2000} --druid town/ second town--
local pos3 = {x = 3000, y = 3000, z = 3000} --knight town/ thrid town--
local pos4 = {x = 4000, y = 4000, z = 4000} --paladin town/ fourth town--
local pos5 = {x = 5000, y = 5000, z = 5000} --5th town/ fifth town--
--<<---------------END----------------------->>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--<<----------Magic Effects------------------>>
if (config.scriptbase1) == false then 
local sorcME = 10 -- if script is based on vocation --
local druidME = 11
local paladinME = 12
local knightME = 13
local voc5ME = 14
else -- if script is based on town --
local sorcME = 10 -- town 1 effect --
local druidME = 11 -- town 2 effect --
local paladinME = 12 -- town 3 effect --
local knightME = 13 -- town 4 effect --
local voc5ME = 14 -- town 5 effect --
end
--<<----------END--------------------------->>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--<<------------MESSAGES-------------------->>
if (config.scriptbase1) == false then -- If script is based on vocation --
local sorcM = "Welcome to that server young sorcerer!"
local druidM = "Welcome to that server young druid!"
local paladinM = "Welcome to that server young paladin!"
local knightM = "Welcome to that server young knight!"
local voc5M = "Welcome to that server 5th voc!"
else --if script is based on town--
local sorcM = "Welcome to that server!" -- Town 1 message--
local druidM = "welcome to that server!" -- town 2 message --
local paladinM = "welcome to that server!" -- town 3 message --
local knightM = "welcome to that server!" -- town 4 message --
local voc5M = "welcome to that server!" -- town 5 message --
end
--<<-------------END----------------------->>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DTT, DSME, DPST, DSAT, MSCR = doTeleportThing, doSendMagicEffect, doPlayerSendText, doSendAnimatedText, MESSAGE_STATUS_CONSOLE_RED 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local gpp = getPlayerPosition(cid)
function onLogin(cid)
if isPlayer(cid) and getPlayerLastLogin(cid) == 0 then
-------------------------------------------------------------------------------------------------------------->>
-------------------------------------------------------------------------------------------------------------->>
-------------------------------------------------------------------------------------------------------------->>
-----------------------------SCRIPT START ALL CREDITS TO GIGASTAR--------------------------------------------->>
-------------------------------------------------------------------------------------------------------------->>
-------------------------------------------------------------------------------------------------------------->>
-------------------------------------------------------------------------------------------------------------->>
if (config.scriptbase1) == true then
if getPlayerTownId(cid, "SELECT `townid` FROM `players` WHERE `" ..getPlayerName(cid) .."") == 1 then
	DTT(cid, pos1)
	DSME(cid, sorcME)
	DPST(cid, MSCR, sorcM)
if (useTownNames) == true then
	DSAT(sorcM, gpp)
else
return false
end
elseif getPlayerTownId(cid, "SELECT `townid` FROM `players` WHERE `" ..getPlayerName(cid) .."") == 2 then
	DTT(cid, pos2)
	DSME(cid, druidME)
	DPST(cid, MSCR, druidM)
if (useTownNames) == true then
	DSAT(druidM, gpp)
else
return false
end
elseif getPlayerTownId(cid, "SELECT `townid` FROM `players` WHERE `" ..getPlayerName(cid) .."") == 3 then
	DTT(cid, pos3)
	DSME(cid, paladinME)
	DPST(cid, MSCR, paladinM)
if (useTownNames) == true then
	DSAT(paladinM, gpp)
else
return false
end
elseif getPlayerTownId(cid, "SELECT `townid` FROM `players` WHERE `" ..getPlayerName(cid) .."") == 4 then
	DTT(cid, pos4)
	DSME(cid, knightME)
	DPST(cid, MSCR, knightM)
if (useTownNames) == true
	DSAT(knightM, gpp)
else
return false
end
elseif getPlayerTownId(cid, "SELECT `townid` FROM `players` WHERE `" ..getPlayerName(cid) .."") == 5 then
	DTT(cid, pos5)
	DSME(cid, voc5ME)
	DPST(cid, MSCR, voc5M)
if (useTownNames) == true
	DSAT(voc5M, gpp)
else
return false
end
end

elseif (config.scriptbase1) == false then
if getPlayerVocation(cid) == 1 then
	DTT(cid, pos1)
	DSME(cid, sorcME)
	DPST(cid, MSCR, sorcM)
if (useTownNames) == true
	DSAT(sorcM, gpp)
else
return false
end
elseif getPlayerVocation(cid) == 2 then
	DTT(cid, pos2)
	DSME(cid, druidME)
	DPST(cid, MSCR, druidM)
if (useTownNames) == true
	DSAT(druidM, gpp)
else
return false
end
elseif getPlayerVocation(cid) == 3 then
	DTT(cid, pos3)
	DSME(cid, paladinME)
	DPST(cid, MSCR, paladinM)
if (useTownNames) == true
	DSAT(paladinM, gpp)
else
return false
end
elseif getPlayerVocation(cid) == 4 then
	DTT(cid, pos4)
	DSME(cid, knightME)
	DPST(cid, MSCR, knightM)
if (useTownNames) == true
	DSAT(knightM, gpp)
else
return false
end
elseif getPlayerVocation(cid) == 5 then
	DTT(cid, pos5)
	DSME(cid, voc5ME)
	DPST(cid, MSCR, voc5M)
if (useTownNames) == true
	DSAT(voc5M, gpp)
else
return false
end
end
end
return false
end
return true
end

Correct Code
Obs : Duplicate Paladin Code
 
Back
Top