deal or no deal game
 

deal or no deal game

Started by Annie, 28 February, 2008, 14:11:05

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Annie

Please can i have this game converted as well cos i love this game and it wont work with the new hub

--[[
Deal or No Deal
LUA 5.1.1
by CrazyGuy and Nillan
version 1.1
Start date February 18th 2007
Last updated on March 11th 2007
Bugs fixed: Sending the final result to pm even though playing in main and not crashing when on picking a case and writing words instead so that the player can be able to chat during the game.
Script is now compatible with both main and pm
thnx Toobster?? for reporting bugs :)
]]--

tCases = {}
sBotname = "?Deal Or No Deal?"
cmdStart = "startdeal"
cmdScores = "dealscores"
cmdHelp = "dealhelp"
cmdReset = "resetdeal"
cmdResetScores = "resetscores"
sQuestion = "Deal, or No Deal?"
fScores = "deal_scores.dat"
iMode = 0
sPMUser = ""

tHighScore = { 
	[1] = { "-", "Nobody", 0 },
	[2] = { "-", "Nobody", 0 },
	[3] = { "-", "Nobody", 0 },
	[4] = { "-", "Nobody", 0 },
	[5] = { "-", "Nobody", 0 },
	[6] = { "-", "Nobody", 0 },
	[7] = { "-", "Nobody", 0 },
	[8] = { "-", "Nobody", 0 },
	[9] = { "-", "Nobody", 0 },
	[10] = { "-", "Nobody", 0 },
}

tGameMessage = {
	[1] = "Not used",
	[2] = "Right, now we've picked the first 6 cases and it is time to see what the bank wants to offer......",
	[3] = "Very brave, now lets move on to Round 2. This round, you will have to pick 5 cases.",
	[4] = "Right, now we've picked 5 more cases and it is time to see what the bank wants to offer......",
	[5] = "Aight Round 3 comming up next. This round, you will have to pick 4 cases.",
	[6] = "4 more cases gone, and not that many left. Let's see what the bank has to say this time......",
	[7] = "Round 4. Are you getting nervous yet ? 3 cases to pick.",
	[8] = "Mr. Banker...Show me the Money !!......",
	[9] = "Now it gets tight. But this round, you only have to pick 2 cases.",
	[10] = "Let's see if we can build that new house......",
}

tScoreBoard = { [1] = 0.01, [2] = 1, [3] = 5, [4] = 10, [5] = 25, [6] = 50, [7] = 75, [8] = 100, [9] = 200, [10] = 300, [11] = 400, [12] = 500, [13] = 750, [14] = 1000, [15] = 5000, [16] = 10000, [17] = 25000, [18] = 50000, [19] = 75000, [20] = 100000, [21] = 200000, [22] = 300000, [23] = 400000, [24] = 500000, [25] = 750000, [26] = 1000000, }
sCurPlayer = ""
iGameState = 0
iCasesPicked = 0
iCasesToPick = 6
tUserCase = {}

Main = function()
	frmHub:RegBot(sBotname)
	LoadTableFile(tHighScore, fScores)
	SetTimer(10000)
	SendToAll(sBotname, "type !"..cmdStart.." to start the game here in main or send a pm to the "..sBotname..", or !"..cmdHelp.." for help with Deal Or No Deal")
end

OnExit = function()
	SafeTableFile(tHighScore, "tHighScore", fScores)
end

ToArrival = function(User, Data)
	if iGameState == 0 then
		local _,_,sTo,sFrom,sPM = string.find(Data, "To%:%s(%S+)%sFrom%:%s(%S+)%s%$%b<>%s(.*)|")
		if sTo == sBotname then
			local _,_,sCMD = string.find (Data, "%b<>%s%p(%S+)|")
			if sCMD == cmdStart then
				-- Here we have to start the game
				iMode = 1
				sCurPlayer = User.sName
				iGameState = 1
				User:SendPM(sBotname, "Welcome "..User.sName..". Are you ready to play Deal or No Deal?")
				RandomizeCases()
				ShowCases()
				User:SendPM(sBotname, User.sName.." ,which case would you like?")
				return 1
			elseif sCMD == cmdScores then
				sPMUser = sFrom
				iMode = 1
				ShowHighScores()
				return 1
			elseif sCMD == cmdHelp then
				sPMUser = sFrom
				iMode = 1
				ShowHelp()
				return 1
			end
		end
	else
		-- Check if it's our player talking
		if User.sName == sCurPlayer then
			local _,_,sCase = string.find(Data, "To%:%s%S+%sFrom%:%s%S+%s%$%b<>%s(.*)|")
			if tGameStates[iGameState] then
				iMode = 1
				if ((tonumber(sCase)) or (string.lower(sCase) == "deal") or (string.find(string.lower(sCase), "no"))) then
					User:SendPM(Data)
					tGameStates[iGameState](sCase)
					return 1
				end
			end
		end
	end
end

OnTimer = function()
	if iGameState ~= 13 then
		if iMode == 0 then
			SendToAll(sBotname, "The Bank offers: "..BankOffer())
			SendToAll(sBotname, sQuestion)
		else
			--send pm
			GetItemByName(sCurPlayer):SendPM(sBotname, "The Bank offers: "..BankOffer())
			GetItemByName(sCurPlayer):SendPM(sBotname, sQuestion)
		end
	else
		for k in pairs(tCases) do
			if tCases[k] ~= 0 then
				if iMode == 0 then
					SendToAll(sBotname, "You did not win..."..tCases[k]..". You've won "..tUserCase[2])
				 else -- send pm
					GetItemByName(sCurPlayer):SendPM(sBotname, "You did not win..."..tCases[k]..". You've won "..tUserCase[2])
				 end
			  break
			end
		end
		if tUserCase[2] >= 100000 then
			if iMode == 0 then
				SendToAll(sBotname, "Congratulations with this big price !!")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Congratulations with this big price !!")
			end
		else
			if iMode == 0 then
				SendToAll(sBotname, "Maybe not your spanish dream mansion, but still you have more than you came with")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Maybe not your spanish dream mansion, but still you have more than you came with")
			end
		end
		CleanUp()
	end
	StopTimer()
end

ChatArrival = function(User, Data)
	if iGameState == 0 then
		-- See who wants to start the game
		local _,_,sCMD = string.find (Data, "%b<>%s%p(%S+)|")
		if sCMD == cmdStart then
			-- Here we have to start the game
			iMode = 0
			sCurPlayer = User.sName
			iGameState = 1
			SendToAll(sBotname, "Welcome "..User.sName..". Are you ready to play Deal or No Deal?")
			RandomizeCases()
			ShowCases()
			SendToAll(sBotname, User.sName.." ,which case would you like?")
			return 1
		elseif sCMD == cmdScores then
			iMode = 0
			ShowHighScores()
			return 1
		elseif sCMD == cmdHelp then
			iMode = 0
			ShowHelp()
			return 1
		elseif sCMD == cmdReset then
			SendToAll(sBotname, "No game to reset")
			return 1
		elseif sCMD == cmdResetScores then
			if User.iProfile ~= -1 then
				local prof = GetProfilePermissions(User.iProfile)
				if prof.bIsOP == 1 then
					tHighScore = { 
						[1] = { "-", "Nobody", 0 },
						[2] = { "-", "Nobody", 0 },
						[3] = { "-", "Nobody", 0 },
						[4] = { "-", "Nobody", 0 },
						[5] = { "-", "Nobody", 0 },
						[6] = { "-", "Nobody", 0 },
						[7] = { "-", "Nobody", 0 },
						[8] = { "-", "Nobody", 0 },
						[9] = { "-", "Nobody", 0 },
						[10] = { "-", "Nobody", 0 },
					}
					SafeTableFile(tHighScore, "tHighScore", fScores)
					SendToAll(sBotname, "Highscores has been reset by "..User.sName)
				end
			end
			return 1
		end
	else
		-- Check if it's our player talking
		if User.sName == sCurPlayer then
			local _,_,sCase = string.find(Data, "%b<>%s(.*)|")
			if tGameStates[iGameState] then
				if ((tonumber(sCase)) or (string.lower(sCase) == "deal") or (string.find(string.lower(sCase), "no"))) then
					SendToAll(Data)
					tGameStates[iGameState](sCase)
					return 1
				end
			end
		else
			if User.iProfile ~= -1 then
				local _,_,sCMD = string.find (Data, "%b<>%s%p(%S+)|")
				local prof = GetProfilePermissions(User.iProfile)
				if (sCMD == cmdReset) and (prof.bIsOP == 1) then
					SendToAll(sBotname, "The game has been reset by "..User.sName)
					CleanUp()
					return 1
				end
			end
		end
	end
end

RandomizeCases = function()
	tCases = { [1] = 0.01, [2] = 1, [3] = 5, [4] = 10, [5] = 25, [6] = 50, [7] = 75, [8] = 100, [9] = 200, [10] = 300, [11] = 400, [12] = 500, [13] = 750, [14] = 1000, [15] = 5000, [16] = 10000, [17] = 25000, [18] = 50000, [19] = 75000, [20] = 100000, [21] = 200000, [22] = 300000, [23] = 400000, [24] = 500000, [25] = 750000, [26] = 1000000, }
	math.randomseed(os.time())
	for k = 1,100 do
		local pos = math.random(1,26)
		local case = table.remove(tCases,pos)
		table.insert(tCases,case)
	end
end

ShowCases = function()
	local sCases = "Cases available:\n\n\t"
	for k = 20,26 do
		if tCases[k] ~= 0 then
			sCases = sCases..k.."\t"
		else
			sCases = sCases.."-\t"
		end
	end
	sCases = sCases.."\n\t"
	for k = 13,19 do
		if tCases[k] ~= 0 then
			sCases = sCases..k.."\t"
		else
			sCases = sCases.."-\t"
		end
	end
	sCases = sCases.."\n\t"
	for k = 7,12 do
		if tCases[k] ~= 0 then
			sCases = sCases..k.."\t"
		else
			sCases = sCases.."-\t"
		end
	end
	sCases = sCases.."\n\t"
	for k = 1,6 do
		if tCases[k] ~= 0 then
			sCases = sCases..k.."\t"
		else
			sCases = sCases.."-\t"
		end
	end
	if iMode == 0 then
	sCases = sCases.."\n"
	SendToAll(sBotname, sCases)
	else --send pm
	GetItemByName(sCurPlayer):SendPM(sBotname, sCases)
	end
end

ShowScoreSheet = function()
	local sScores = "Current Score Sheet:\n\n"
	for k = 1,13 do
		sScores = sScores.."\t\t"
		if tScoreBoard[k] ~= 0 then
			sScores = sScores..tScoreBoard[k].."\t\t"
		else
			sScores = sScores.."(XXX)\t\t"
		end
		if tScoreBoard[(k+13)] ~= 0 then
			sScores = sScores..tScoreBoard[(k+13)].."\n"
		else
			sScores = sScores.."(XXX)\n"
		end
	end
	if iMode == 0 then
	sScores = sScores.."\n"
	SendToAll(sBotname, sScores)
	else --send pm
	GetItemByName(sCurPlayer):SendPM(sBotname, sScores)
	end
end	
RevealCases = function()
	local sReveal = "Let's see what was in all the cases that are left:\n"
	for k = 1, 26 do
		if tCases[k] ~= 0 then
			sReveal = sReveal.."Case number "..k.." had "..tCases[k].."\n"
		end
	end
	if iMode == 0 then
		sReveal = sReveal.. "Your case (case number "..tUserCase[1]..") had "..tUserCase[2].."\n"
		SendToAll(sBotname, sReveal)
	else --send pm
		sReveal = sReveal.. "Your case (case number "..tUserCase[1]..") had "..tUserCase[2].."\n"
		GetItemByName(sCurPlayer):SendPM(sBotname, sReveal)
	end
end
	
BankOffer = function()
	local amount = 0
	local iCases = 0
	for k in pairs(tCases) do
		if tCases[k] ~= 0 then
			amount = amount + tCases[k]
			iCases = iCases + 1
		end
	end
	-- add user's case + amount
	amount = amount + tUserCase[2]
	iCases = iCases + 1
	amount = math.ceil(amount / iCases)
	return amount
end

tGameStates = {
	[1] = function(sArg)
		if (tonumber(sArg)) and (tonumber(sArg) > 0) and (tonumber(sArg) < 27) then
			tUserCase = { tonumber(sArg), tCases[tonumber(sArg)] }
			iGameState = 2
			if iMode == 0 then
				SendToAll(sBotname, "Goodluck with that 1 :P")
				tCases[tonumber(sArg)] = 0
				ShowCases()
				SendToAll(sBotname, "Round 1. You will have to pick 6 cases. Start with the first case now.")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Goodluck with that 1 :P")
				tCases[tonumber(sArg)] = 0
				ShowCases()
				GetItemByName(sCurPlayer):SendPM(sBotname, "Round 1. You will have to pick 6 cases. Start with the first case now.")
			end
		else
			if iMode == 0 then
				SendToAll(sBotname, "Please enter a case number from 1 to 26")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Please enter a case number from 1 to 26")
			end
		end
	end,
	[2] = function(sArg)
		if (tonumber(sArg)) and (tonumber(sArg) > 0) and (tonumber(sArg) < 27) and (tCases[tonumber(sArg)] ~= 0) then
			DoPick(sArg)
			if iCasesPicked < iCasesToPick then
				ShowCases()
				if iMode == 0 then
					SendToAll(sBotname, "Pick another case.")
				else --send pm
					GetItemByName(sCurPlayer):SendPM(sBotname, "Pick another case.")
				end
			else
				if iMode == 0 then
					ShowScoreSheet()
					iCasesPicked = 0
					iCasesToPick = iCasesToPick - 1
					SendToAll(sBotname, tGameMessage[iGameState])
					iGameState = iGameState + 1
					StartTimer()
				else --send pm
					ShowScoreSheet()
					iCasesPicked = 0
					iCasesToPick = iCasesToPick - 1
					GetItemByName(sCurPlayer):SendPM(sBotname, tGameMessage[iGameState])
					iGameState = iGameState + 1
					StartTimer()
				end
			end
		else
			if iMode == 0 then
				SendToAll(sBotname, "That's not a valid pick. Please pick another case")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "That's not a valid pick. Please pick another case")
			end	
		end
	end,
	[3] = function(sArg)
		if string.lower(sArg) == "deal" then
			-- game over, user took money and ran
			if iMode == 0 then
				SendToAll(sBotname, "Congratulations ! You have won "..BankOffer())
				UpdateHighScores("Deal", BankOffer())
				RevealCases()
				CleanUp()
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Congratulations ! You have won "..BankOffer())
				UpdateHighScores("Deal", BankOffer())
				RevealCases()
				CleanUp()
			end
		elseif (string.find(string.lower(sArg), "no%s")) or (string.lower(sArg) == "no")  then
			-- continue
			if iMode == 0 then
				SendToAll(sBotname, tGameMessage[iGameState])
				ShowCases()
				SendToAll(sBotname, "Make your first pick now")
				iGameState = iGameState + 1
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, tGameMessage[iGameState])
				ShowCases()
				GetItemByName(sCurPlayer):SendPM(sBotname, "Make your first pick now")
				iGameState = iGameState + 1
			end
		end
	end,
	[4] = function(sArg)
		tGameStates[2](sArg)
	end,
	[5] = function(sArg)
		tGameStates[3](sArg)
	end,
	[6] = function(sArg)
		tGameStates[2](sArg)
	end,
	[7] = function(sArg)
		tGameStates[3](sArg)
	end,
	[8] = function(sArg)
		tGameStates[2](sArg)
	end,
	[9] = function(sArg)
		tGameStates[3](sArg)
	end,
	[10] = function(sArg)
		tGameStates[2](sArg)
	end,
	[11] = function(sArg)
		if string.lower(sArg) == "deal" then
			-- game over, user took money and ran
			if iMode == 0 then
				SendToAll(sBotname, "Congratulations ! You have won "..BankOffer())
				UpdateHighScores("Deal", BankOffer())
				RevealCases()
				CleanUp()
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "Congratulations ! You have won "..BankOffer())
				UpdateHighScores("Deal", BankOffer())
				RevealCases()
				CleanUp()
			end
		elseif (string.find(string.lower(sArg), "no%s")) or (string.lower(sArg) == "no")  then
			-- continue
			local iLeft = 0
			local iNumber = 0
			for k in pairs(tCases) do
				if tCases[k] ~= 0 then
					iLeft = iLeft + 1 
					iNumber = k
				end
			end
			if iLeft > 1 then
				if iMode == 0 then
					ShowCases()
					SendToAll(sBotname, "Pick 1 case.")
					iGameState = iGameState + 1
				else --send pm
					ShowCases()
					GetItemByName(sCurPlayer):SendPM(sBotname, "Pick 1 case.")
					iGameState = iGameState + 1
				end
			else
				if iMode == 0 then
					SendToAll(sBotname, "You did not take the bank's final offer. You have 1 chance to swap cases.")
					SendToAll(sBotname, "You have case number "..tUserCase[1].." and out there is "..iNumber)
					SendToAll(sBotname, "Choose which case you want to keep")
					iGameState = 13
					tCases[tonumber(tUserCase[1])] = tonumber(tUserCase[2])
				else --send pm
					GetItemByName(sCurPlayer):SendPM(sBotname, "You did not take the bank's final offer. You have 1 chance to swap cases.")
					GetItemByName(sCurPlayer):SendPM(sBotname, "You have case number "..tUserCase[1].." and out there is "..iNumber)
					GetItemByName(sCurPlayer):SendPM(sBotname, "Choose which case you want to keep")
					iGameState = 13
					tCases[tonumber(tUserCase[1])] = tonumber(tUserCase[2])
				end
			end
		end
	end,
	[12] = function(sArg)
		if (tonumber(sArg)) and (tonumber(sArg) > 0) and (tonumber(sArg) < 27) and (tCases[tonumber(sArg)] ~= 0) then
			if iMode == 0 then
				DoPick(sArg)
				ShowScoreSheet()
				iCasesPicked = 0
				SendToAll(sBotname, "Calling the banker......")
				iGameState = iGameState - 1
				StartTimer()
			else --send pm
				DoPick(sArg)
				ShowScoreSheet()
				iCasesPicked = 0
				GetItemByName(sCurPlayer):SendPM(sBotname, "Calling the banker......")
				iGameState = iGameState - 1
				StartTimer()
			end
		else
			if iMode == 0 then
				SendToAll(sBotname, "That's not a valid pick. Please pick another case")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "That's not a valid pick. Please pick another case")
			end
		end
	end,
	[13] = function(sArg)
		if (tonumber(sArg)) and (tonumber(sArg) > 0) and (tonumber(sArg) < 27) and (tCases[tonumber(sArg)] ~= 0) then
			if iMode == 0 then
				tUserCase = { tonumber(sArg), tCases[tonumber(sArg)] }
				tCases[tonumber(sArg)] = 0
				UpdateHighScores("No Deal", tUserCase[2])
				SendToAll(sBotname, "Your final choice is case "..tonumber(sArg)..". We will now look what is in the other case....")
				StartTimer()
			else--send pm
				tUserCase = { tonumber(sArg), tCases[tonumber(sArg)] }
				tCases[tonumber(sArg)] = 0
				UpdateHighScores("No Deal", tUserCase[2])
				GetItemByName(sCurPlayer):SendPM(sBotname, "Your final choice is case "..tonumber(sArg)..". We will now look what is in the other case....")
				StartTimer()
			end
		else
			if iMode == 0 then
				SendToAll(sBotname, "That's not a valid pick. Please pick another case")
			else --send pm
				GetItemByName(sCurPlayer):SendPM(sBotname, "That's not a valid pick. Please pick another case")
			end
		end
	end,
}

DoPick = function(sArg)
	if iMode == 0 then
		SendToAll(sBotname, "You picked case number "..tonumber(sArg).." . Your case does not contain "..tCases[tonumber(sArg)])
	else --send pm
		GetItemByName(sCurPlayer):SendPM(sBotname, "You picked case number "..tonumber(sArg).." . Your case does not contain "..tCases[tonumber(sArg)])
	end
	for k in pairs(tScoreBoard) do
		if tScoreBoard[k] == tCases[tonumber(sArg)] then
			tScoreBoard[k] = 0
			break
		end
	end
	if tCases[tonumber(sArg)] < 5000 then
		if iMode == 0 then
			SendToAll(sBotname, "Very well done. That should help you alot")
		else --send pm
			GetItemByName(sCurPlayer):SendPM(sBotname, "Very well done. That should help you alot")
		end
	elseif (tCases[tonumber(sArg)] >= 5000) and (tCases[tonumber(sArg)] < 100000) then
		if iMode == 0 then
			SendToAll(sBotname, "That wasn't too bad")
		else --send pm
			GetItemByName(sCurPlayer):SendPM(sBotname, "That wasn't too bad")
		end
	elseif (tCases[tonumber(sArg)] >= 100000) and (tCases[tonumber(sArg)] < 1000000) then
		if iMode == 0 then
		SendToAll(sBotname, "hmmm, well okay. Let's see what the rest brings")
		else --send pm
		GetItemByName(sCurPlayer):SendPM(sBotname, "hmmm, well okay. Let's see what the rest brings")
		end
	elseif (tCases[tonumber(sArg)] == 1000000) then
		if iMode == 0 then
			SendToAll(sBotname, "OH NO !, Not that 1 !! No more chance on a million for you :(")
		else --send pm
			GetItemByName(sCurPlayer):SendPM(sBotname, "OH NO !, Not that 1 !! No more chance on a million for you :(")
		end
	end
	iCasesPicked = iCasesPicked + 1
	tCases[tonumber(sArg)] = 0
end

UpdateHighScores = function(sDeal,iScore)
	for k = 1,10 do
		if iScore >= tHighScore[k][3] then
			for l = 9,k,-1 do
				tHighScore[(l+1)] = tHighScore[l]
			end
			tHighScore[k] = { sDeal, sCurPlayer, iScore }
			break
		end
	end
end

ShowHighScores = function()
	local sHS = "Top 10 Deal or no Deal scores:\n\n"
		.."\tDeal?\t\tScore\t\t\tPlayer\n\n"
	for k = 1,10 do
		sHS = sHS.."\t"..tHighScore[k][1].."\t\t"..tHighScore[k][3].."\t\t\t"..tHighScore[k][2].."\n"
	end
	if iMode == 0 then
		SendToAll(sBotname, sHS)
	else --send pm
		GetItemByName(sPMUser):SendPM(sBotname, sHS)
	end
end

ShowHelp = function()
	local sHelp = "Deal or No Deal Help file\n\n"
		.."\t!"..cmdHelp.."\t\tThis help file\n"
		.."\t!"..cmdStart.."\t\tStarts a new game\n"
		.."\t!"..cmdScores.."\tShow top 10 High Scores\n"
		.."\t!"..cmdReset.."\t\tReset the game ( OPs only )\n"
		.."\t!"..cmdResetScores.."\tReset the High Scores ( OPs only )\n"
	if iMode == 0 then
		SendToAll(sBotname, sHelp)
	else --send pm
		GetItemByName(sPMUser):SendPM(sBotname, sHelp)
	end
	return 1
end

LoadTableFile = function(tTable, fFile)
	local fHandle = io.open(fFile)
	if fHandle ~= nil then
		fHandle:close()
		tTable.items = dofile(fFile)
	end
end

--SafeTableFile returns 1 on success, nil on error
SafeTableFile = function(tTable, sTable, fFile)
	local fHandle = io.open(fFile, "w+")
	if fHandle ~= nil then
		fHandle:write(Serialize(tTable, sTable))
		fHandle:flush()
		fHandle:close()
		return 1
	end
end

Serialize = function(tTable, sTableName, sTab)
	sTab = sTab or "";
	sTmp = ""
	sTmp = sTmp..sTab..sTableName.." = {\n"
	for key, value in pairs(tTable) do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end

		sTmp = sTmp..",\n"
	end
	sTmp = sTmp..sTab.."}"
	return sTmp
end

CleanUp = function()
tScoreBoard = { [1] = 0.01, [2] = 1, [3] = 5, [4] = 10, [5] = 25, [6] = 50, [7] = 75, [8] = 100, [9] = 200, [10] = 300, [11] = 400, [12] = 500, [13] = 750, [14] = 1000, [15] = 5000, [16] = 10000, [17] = 25000, [18] = 50000, [19] = 75000, [20] = 100000, [21] = 200000, [22] = 300000, [23] = 400000, [24] = 500000, [25] = 750000, [26] = 1000000, }
sCurPlayer = ""
iGameState = 0
tUserCase = {}
iCasesPicked = 0
iCasesToPick = 6
SafeTableFile(tHighScore, "tHighScore", fScores)
SendToAll(sBotname, "I'm ready for another game. type !"..cmdStart.." to start a new game")
end

NewUserConnected = function(User)
	User:SendData("$UserCommand 2 7 "..frmHub:GetHubName().."\\Deal Or No Deal\\Help$<%[mynick]> !"..cmdHelp.."&#124;")
	User:SendData("$UserCommand 2 7 "..frmHub:GetHubName().."\\Deal Or No Deal\\Play a game$<%[mynick]> !"..cmdStart.."&#124;")
	User:SendData("$UserCommand 2 7 "..frmHub:GetHubName().."\\Deal Or No Deal\\Show scores$<%[mynick]> !"..cmdScores.."&#124;")
end
OpConnected = function(User)
	NewUserConnected(User)
	User:SendData("$UserCommand 2 7 "..frmHub:GetHubName().."\\Deal Or No Deal\\Reset a game in progress$<%[mynick]> !"..cmdReset.."&#124;")
	User:SendData("$UserCommand 2 7 "..frmHub:GetHubName().."\\Deal Or No Deal\\Reset High Scores$<%[mynick]> !"..cmdResetScores.."&#124;")
end



thank you :)

SMF spam blocked by CleanTalk