• 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 GlobalEvent New player Set-up script TFS 8.54

gigastar

Member
Joined
Jan 25, 2009
Messages
252
Reaction score
15
This is ment for people that cannot figure out, or do not want a website for there client.

This is a very basic script, if you would like something a little more suited to your server, you can msg on here with information on what you need for your server specifically.

I did not add in giving items to vocations, if anyone wants this, say something ill release it on here, obviously not hard, that's why I will release. Anyway, hope this helps someone.

Code:
---------------------------------------------------------ALL CREDITS OF THIS SCRIPT ARE TO GIGASTAR------------------------------------------------------------------------->>
-------CONFIGURATION-------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
----SCRIPT OVERBASE---
local scriptOverBase = true -- If true the script is based on vocation. If false, the script will check the accounts DATABASE set townid. and send him there.--
---------END----------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
--------TOWNS--------
local town1 = {x = 1000, y = 1000, z = 7} -- sorcerer comes here --
local town2 = {x = 1000, y = 1000, z = 7} -- druid comes here --
local town3 = {x = 1000, y = 1000, z = 7} -- paladin comes here --
local town4 = {x = 1000, y = 1000, z = 7} -- knight comes here --
local town5 = {x = 1000, y = 1000, z = 7} -- 5th voc comes here --
--------END----------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
-------MESSAGE SETTINGS----
local broadcastNewPlayer = true
local useAdvancedMessageSystem = true  -- If false msgWithoutInfo is default msg --
local msgMain = "has joined the server!"
local showName = true
local msgName = "Player"
local msgNoName =  "A new player"
local showVoc = true
local msgVoc = "he is a"
local showTown = true
local msgTown = "He started in"
local msgSend = "Welcome to the server. You can use help chat to ask questions." -- This will be sent to every new player in there default dialog box. --
local msgWithoutInfo = "A new player has joined the server!" -- This is the message you use if you do not want to say anything about the player.
-- This message will be: "Player (playername) has joined the server! He started in (town name). He is a (vocation name)." --
----------END--------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
--------MAGIC EFFECTS------
local useMagicEffects = true
local sorc1 = 10 -- Town 1 or sorcerer effect --
local druid1 = 11 -- town 2 or druid effect --
local paladin1 = 12 -- so on --
local knight1 = 13
local voc5ME = 14
--------END----------------
-----------------------------------------IF YOU ARE NOT USING VOCATION SIDE OF SCRIPT EDIT HERE!!!!!!!!!!!------------------------------------------------------------------
townId1 = 1 -- town id of sorcerers town, or 1st town to go to. --
townId2 = 2 -- town id of druid town, or 2nd town to go to. --
townId3 = 3 -- so on --
townId4 = 4
townId5 = 5
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
------------------------------------------------------------------------------END CONFIGURATION---------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
------------CUSTOM FUNCTION-------------------------------------
local function advancedMsgSystem()
		if (broadcastNewPlayer) == true then
		if (showName) and (showVoc) and (showTown) == false
		local msg = "A new player has joined the server!"
			doBroadcastMessage(msg, 1)
			elseif	(showName) and (showVoc) and (showTown) == true
			local msg = "" .. msgName .. " " .. getPlayerName(cid) .." " .. msgMain.. ". " .. msgTown .. " " .. getPlayerTown(cid) .. ". " .. msgVoc .. " " getPlayerVocation(cid) "."
			doBroadcastMessage(msg, 1)
				elseif (showName) and (showVoc) == true and (showTown) == false
				local msg = "" .. msgName .. " " .. getPlayerName(cid) .." " .. msgMain.. ". " .. msgVoc .. " " getPlayerVocation(cid) "."
				doBroadcastMessage(msg, 1)
					elseif (showName) == true and (showVoc) and (showTown) == false
					local msg = "" .. msgName .. " " .. getPlayerName(cid) .." " .. msgMain.. "."
					doBroadcastMessage(msg, 1)
				elseif (showName) == false and (showVoc) and (showTown) == true
				local msg = "" .. msgMain.. " " .. msgTown .. " " .. getPlayerTown(cid) .. ". " .. msgVoc .. " " getPlayerVocation(cid) "."
				doBroadcastMessage(msg, 1)
			elseif (showName) == false and (showVoc) == true and (showtown) == false
			local msg = "" .. msgMain.. ". " .. msgVoc .. " " getPlayerVocation(cid) "."
			doBroadcastMessage(msg, 1)
		elseif (showName) == true and (showVoc) == false and (showTown) == true
		local msg = "" .. msgName .. " " .. getPlayerName(cid) .." " .. msgMain.. " " .. msgTown .. " " .. getPlayerTown(cid) .. "."
		doBroadcastMessage(msg, 1)
else
local msg = "" .. msgMain .. ""
	doBroadcastMessage(msg, 1)
return true
end
return true
end
else
return true
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
------------------------------------------------------------------------START OF SCRIPT!----------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------->>

function onLogin(cid)
	if isPlayer(cid) and getPlayerLastLogin(cid) == 0 then
		if (scriptOverBase) == true then
		------------------------------------------------------THIS IS VOCATION REQUIRED PART OF SCRIPT, if scriptOverBase = false ignore all of this----------------------------
if	getPlayerVocation(cid) == 1 then
				doTeleportThing(cid, town1)
				doPlayerSendText(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
			if (useMagicEffects) == true then
			doSendMagicEffect(getPlayerPosition(cid), sorc1)
else
return true
end
	if (useAdvancedMessageSystem) == true then
		advancedMsgSystem()
	else
return false
end

elseif getPlayerVocation(cid) == 2 then
				doTeleportThing(cid, town2)
				doPlayerSendText(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
			if (useMagicEffects) == true then
			doSendMagicEffect(getPlayerPosition(cid), druid1)
else
return true
end
	if (useAdvancedMessageSystem) == true then
		advancedMsgSystem()
	else
return false
end

elseif getPlayerVocation(cid) == 3 then
				doTeleportThing(cid, town3)
				doPlayerSendText(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
			if (useMagicEffects) == true then
			doSendMagicEffect(getPlayerPosition(cid), paladin1)
else
return true
end
	if (useAdvancedMessageSystem) == true then
		advancedMsgSystem()
	else
return false
end

elseif getPlayerVocation(cid) == 4 then
				doTeleportThing(cid, town4)
				doPlayerSendText(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
			if (useMagicEffects) == true then
			doSendMagicEffect(getPlayerPosition(cid), knight1)
else
return true
end
	if (useAdvancedMessageSystem) == true then
		advancedMsgSystem()
	else
return false
end

elseif getPlayerVocation(cid) == 5 then
				doTeleportThing(cid, town5)
				doPlayerSendText(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
			if (useMagicEffects) == true then
			doSendMagicEffect(getPlayerPosition(cid), voc5ME)
else
return true
end
	if (useAdvancedMessageSystem) == true then
		advancedMsgSystem()
	else
return false
end
end

else ----------------------------------------------------------------------EXIT VOCATION SCRIPT SIDE---------------------------------------------------------------------

if (scriptOverBase) == false then
local res = db.getResult('SELECT `townid` FROM `players` WHERE `name` = '..getPlayerName(cid)..'')
if	(res) == townId1 then
	doTeleportThing(cid, town1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
if	(useMagicEffects) == true then
	doSendMagicEffect(getPlayerPostion(cid), sorc1)
else
end
if (useAdvancedMessageSystem) == true then
	advancedMsgSystem()
else
end

elseif (res) == townId2 then
	doTeleportThing(cid, town2)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
if	(useMagicEffects) == true then
	doSendMagicEffect(getPlayerPostion(cid), druid1)
else
end
if (useAdvancedMessageSystem) == true then
	advancedMsgSystem()
else
end
elseif (res) == townId3 then
	doTeleportThing(cid, town3)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
if	(useMagicEffects) == true then
	doSendMagicEffect(getPlayerPostion(cid), paladin1)
else
end
if (useAdvancedMessageSystem) == true then
	advancedMsgSystem()
else
end
elseif (res) == townId4 then
	doTeleportThing(cid, town4)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
if	(useMagicEffects) == true then
	doSendMagicEffect(getPlayerPostion(cid), knight1)
else
end
if (useAdvancedMessageSystem) == true then
	advancedMsgSystem()
else
end
elseif (res) == townId5 then
	doTeleportThing(cid, town5)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, msgSend)
if	(useMagicEffects) == true then
	doSendMagicEffect(getPlayerPostion(cid), voc5ME)
else
end
if (useAdvancedMessageSystem) == true then
	advancedMsgSystem()
end
end
end
end
end
return true
end


*Edited put in broadcastNewPlayer = true option.
 
Last edited:
It would be good to explain how to install please and Thank you!
 

Similar threads

Back
Top