• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

jackpot request

rcb chief

New Member
Joined
Dec 23, 2008
Messages
53
Reaction score
0
I would like a script for like a casino. this are the things id like.

-when server start jackpot is 100 tokens (id 2157)
-probabilities of winning 1 out of a 100
-for every person who loses adds 5 tokens to jackpot
-and if someone win he gets all the added reward of tokens
-and jackpot resets to 100 tokens

thx alot will rep++
 
Try this.. not promising much tho

Edit 11:57
Code:
function onUse(cid, item, frompos, item2, topos)

	local jackpotRand = math.random (1,100)
	local tokens = 2157 
	local number = getPlayerItemCount(cid, tokens)
	local jackpot = getGlobalStorageValue(30200) 

	if (jackpot < 100) then
		jackpot = 100
	end
	
	if item2.itemid == 9889 or item2.itemid == 9892 then
               if (doPlayerRemoveItem(cid,tokens,5) then
			if(jackpotRand == 1) then
				doPlayerRemoveItem(cid,tokens,number-5)
				doPlayerAddItem(cid, tokens, number+jackpot)
                                jackpot = 100
			else
				jackpot = jackpot + 5
			end
		end
	end
	setGlobalStorageValue(30200, jackpot)
end
 
im getting this
[05/06/2010 23:01:44] [Error - LuaScriptInterface::loadFile] data/actions/scripts/jackpot.lua:11: ')' expected near 'then'
[05/06/2010 23:01:44] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/jackpot.lua)
[05/06/2010 23:01:44] data/actions/scripts/jackpot.lua:11: ')' expected near 'then'
[05/06/2010 23:01:44] [Error - LuaScriptInterface::loadFile] data/actions/scripts/jackpot.lua:11: ')' expected near 'then'
[05/06/2010 23:01:44] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/jackpot.lua)
[05/06/2010 23:01:44] data/actions/scripts/jackpot.lua:11: ')' expected near 'then'

Edit: i fixed that let me check if it works
Edit2: looks like it works, but one more thing how can i make it that for each time i use it it tells you the current jackpot, or is there any other way(like.. looking it or something?)
 
Last edited:
look at it before you bet or after?

put like
for position put where your gold stack is behind your machine
obviously your going to need to define jackpot again
i would make the color green

doSendAnimatedText(pos, jackpot, color[, player])

maybe put it into a global event that woudl keep refreshing the text
 
anytime man, i'm just so bored.. half of the functions they claim are in tfs0.3.6 don't work pretty much anything that has to do with items my server says the function doesn't exist.. but its listed in their Docs... so just waiting for a response from somone about that
 
im kind of stuck again
i just started learning lua 2 days ago and barely understand the basics

this is what i got
local config = {
positions = {
["Jackpot ".. jackpot ..""] = { x = 105, y = 38, z = 7 },
}
}

function onThink(cid, interval, lastExecution)
for text, pos in pairs(config.positions) do
doSendAnimatedText(pos, jackpot, color, [player])
end

return TRUE
end

i changed in the other script of the jackpot the word 'jackpot' to global.. i think

EDit: btw i just kind of based in another animated text script :P
 
i could get it to work but it doesnt change.. the number of the jackpot doesnt change unless i do reload globalevents

local jackpot = getGlobalStorageValue(30200)
local config = {
positions = {
["Items"] = { x = 105, y = 38, z = 7 },
["Treiners"] = { x = 95, y = 38, z = 7 },
["".. jackpot ..""] = { x = 71, y = 47, z = 6 }
}
}

function onThink(cid, interval, lastExecution)
for text, pos in pairs(config.positions) do
doSendAnimatedText(pos, text, math.random(1, 255))
end

return TRUE
end
 
anytime man, i'm just so bored.. half of the functions they claim are in tfs0.3.6 don't work pretty much anything that has to do with items my server says the function doesn't exist.. but its listed in their Docs... so just waiting for a response from somone about that
Yea, devs accidentally the docs

http://svn.otland.net/public/viewvc.cgi/forgottenserver/tags/0.3.6pl1/luascript.cpp?view=co


Code:
function onThink(cid, interval, lastExecution)
	local config = {
		positions = {
			['Items'] = { x = 105, y = 38, z = 7 },
			['Trainers'] = { x = 95, y = 38, z = 7 },
			[getGlobalStorageValue(30200)] = { x = 71, y = 47, z = 6 }
		}
	}

	for text, pos in pairs(config.positions) do
		doSendAnimatedText(pos, text, math.random(1, 255))
	end

	return true
end
 
Back
Top