Well, this is the highscore script for Mock's Tetris System. I
post it here as a request by some ppl. 100% by Me
You can use my modified script: (There I changed the animated texts for channel messages and the storage for a variable)
Or the original script with the queries added:
Step 3) Finally, the PHP stuff
For Gesior AAC:
a) Add these pictures into htdocs/images/
View attachment tetris.rar
b) Add this to index.php
b) Create htdocs/tetris.php
For Modern AAC:
a) Add these pictures into htdocs/public/images/
View attachment tetris.rar
b) Create this new page in Modern AAC's Admin Panel
URLs for AACs templates
Gesior AAC
Modern AAC
That's it :wub: Pleaze comment
PLEASE RESPECT THE COPYRIGHTS. IF YOU APPRECIATE AND USE MY HARD WORK LEAVE IT LIKE IT IS ^^
post it here as a request by some ppl. 100% by Me
Tested with Gesior AAC latest rev, Modern AAC 0.2 rev.135, TFS 0.3.6pl1
Made for: [Action] Tetris system by mock
LIVE DEMO: Kinera - Tetris
Gesior AAC
Modern AAC
The current record is on top, then the other scores are displayed below.
Step 2) Modify your LUA script (data/actions/scripts/tetris.lua)Made for: [Action] Tetris system by mock
LIVE DEMO: Kinera - Tetris
Gesior AAC
Modern AAC
The current record is on top, then the other scores are displayed below.
Step 1) Add the new database table (MySQL)
Execute this query into your phpmyadmin
Execute this query into your phpmyadmin
PHP:
CREATE TABLE IF NOT EXISTS `tetris` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player` int(11) DEFAULT NULL,
`score` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
You can use my modified script: (There I changed the animated texts for channel messages and the storage for a variable)
Lua:
--[[
Tetris system By mock the bear (mtb)
Modified by Cybermaster for PHP Highscores
Email: [email][email protected][/email]
Visit OTland.net ^^
Enjoy ""
]]
local config = {
score = 21452, --storage for player's score
uppos = {x=1211,y=827,z=7},
dowpos = {x=1217,y=838,z=7},
playerpos = {x=1219,y=835,z=7},
Bloqueo_start={x=1214,y=829,z=7},
exit={x=1219,y=838,z=7},
delay=10,
item=1739,
effects = {
mark=3,
burn=39,
},
Bloqueos = {
--
{
{
{0,1,0},
{1,1,1},
{0,0,0},
},
{
{0,1,0},
{0,1,1},
{0,1,0},
},
{
{0,0,0},
{1,1,1},
{0,1,0},
},
{
{0,1,0},
{1,1,0},
{0,1,0}
}
},
{
{
{1,1,1},
},
{
{1},
{1},
{1},
},
},
--
{
{
{1},
},
},
{
{
{1,1},{1,1},
},
},
},
data={false},
}
local function createItensInArea(item, pos, area) -- Function by mock
local centro = {}
local coisa = {}
centro.y = math.floor(#area/2)+1
for y = 1, #area do
for x = 1, #area[y] do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z}
local items = doCreateItem(item, 1, pos)
table.insert(coisa, 1, items)
end
end
end
return coisa
end
local function removeItensInArea(item, pos, area) -- Function by mock
local centro = {}
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z,stackpos = 255}
local coisa = getThingfromPos(pos)
if coisa.itemid == item then
doRemoveItem(coisa.uid,1)
end
end
end
end
end
local function checkItensInArea(item, pos, area,coisas) -- Function by mock
local centro = {}
if coisas == nil then
coisas = {}
end
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z,stackpos = 1}
local coisa = getThingfromPos(pos)
if coisa.itemid == item then
if not isInArray(coisas, coisa.uid) then
return true
end
end
end
end
end
return false
end
function clean(pos1,pos2,stack) -- Function by mock
for x = 0, math.floor(pos2.x-pos1.x) do
for y = 0, math.floor(pos2.y-pos1.y) do
local coisa = getThingfromPos({x = pos1.x+x, y = pos1.y+y, z = pos1.z, stackpos = stack})
if coisa.itemid == config.item then
doRemoveItem(coisa.uid,1)
end
end
end
end
local function pushdown(pos1,pos2,item) -- push all piece 1 sqm to down
-- Function by mock
local ymax = math.floor(pos2.y-pos1.y)
for y = 1,ymax do
for x = 1, math.floor(pos2.x-pos1.x)-1 do
local coisa = getThingfromPos({x = pos1.x+x, y = pos1.y+(ymax-y), z = pos1.z, stackpos = 1})
if coisa.itemid == item then
local p2 = getThingPos(coisa.uid)
doRemoveItem(coisa.uid,1)
p2.y = p2.y+1
doCreateItem(item, 1, p2)
end
end
end
end
local function checkline(pos,cid,item) -- Function by mock
local sizex = config.dowpos.x-config.uppos.x-1
local t = {}
for x=1,sizex do
local using = {x=pos.x+x,y=pos.y,z=pos.z,stackpos=1}
local igz = getThingfromPos(using)
if igz.itemid == item then
table.insert(t,1,{using,igz.uid})
end
end
if #t == sizex then
setPlayerStorageValue(cid,score, getPlayerStorageValue(cid, score)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[TETRIS] Current Score: "..getPlayerStorageValue(cid, score))
for i=1,#t do
local f = t[i]
doRemoveItem(f[2],1)
doSendMagicEffect(f[1],config.effects.burn)
end
pushdown(config.uppos,{x=config.dowpos.x,y=pos.y,z =config.dowpos.z},item)
checkline(pos,cid,item)
end
end
function doSendMagicEffectInArea(pos,effect,area,cid) -- Function by mock
local centro = {}
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
if area[y][x] > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
if type(effect) == 'table' then
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},(effect[area[y][x]] or 0),cid)
else
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},effect or 0,cid)
end
end
end
end
return true
end
local function pedra(pos,cid,area) -- Function by mock
config.data = config.data or {}
config.data[6] = config.data[6] or config.delay
config.data[5] = config.data[5] or 1
config.data[5] = config.data[5]+1
if config.data[1] == false then
config.data[1] = #area == 1 and 1 or math.random(1,#area)
end
local cre_pos = getCreaturePosition(cid)
pos.stackpos = 255
pos.y = pos.y-1
if getThingfromPos(pos).itemid == config.item then
removeItensInArea(config.item,pos, area[config.data[1]])
end
if config.data[5] >= config.data[6] then
pos.y = pos.y+1
config.data[5] = 1
end
pos.stackpos = 1
if cre_pos.x == config.playerpos.x+1 then
doTeleportThing(cid, config.playerpos)
pos.x = pos.x+1
local coisa2 = getThingfromPos(pos)
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.x = pos.x-1
doSendAnimatedText(cre_pos, "BLOCK", math.random(1,255))
end
elseif cre_pos.x == config.playerpos.x and cre_pos.y == config.playerpos.y+1 then
doTeleportThing(cid, config.playerpos)
pos.y = pos.y+1
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.y = pos.y-1
doSendAnimatedText(cre_pos, "BLOCK", math.random(1,255))
end
elseif cre_pos.x == config.playerpos.x and cre_pos.y == config.playerpos.y-1 then
doTeleportThing(cid, config.playerpos)
if #area > 1 then
local rot = #area < config.data[1]+1 and 1 or config.data[1]+1
if checkItensInArea(463,pos, area[rot]) or checkItensInArea(config.item,pos, area[rot]) then
doSendAnimatedText(cre_pos, "BLOCK", math.random(1,255))
else
config.data[1] = rot
end
end
elseif cre_pos.x == config.playerpos.x-1 then
doTeleportThing(cid, config.playerpos)
pos.x = pos.x-1
local coisa2 = getThingfromPos(pos)
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.x = pos.x+1
doSendAnimatedText(cre_pos, "BLOCK", math.random(1,255))
end
end
if config.data[3] then
config.data[3] = nil
return
end
pos.stackpos=1
if getThingfromPos(pos).itemid == config.item then
if getPlayerStorageValue(cid, score) > 0 then
db.executeQuery("INSERT INTO `tetris` (`id`, `player`, `score`) VALUES (NULL, '" .. getPlayerGUID(cid) .. "', '"..getPlayerStorageValue(cid, score).."');")
end
doPlayerSendTextMessage(config.data[2], MESSAGE_STATUS_CONSOLE_ORANGE, '[TETRIS] You lose! X(! You scored ' ..getPlayerStorageValue(config.data[2], score)..' points.')
clean(config.uppos,config.dowpos,2)
clean(config.uppos,config.dowpos,1)
creation = nil
doTeleportThing(config.data[2], config.exit)
config.data[2] = nil
config.data[1] = false
config.data[3] = true
return
end
local uida = createItensInArea(config.item,pos, area[config.data[1]])
local humrox = pos
pos.y = pos.y+1
if not checkItensInArea(463,pos, area[config.data[1]]) and not checkItensInArea(config.item,humrox, area[config.data[1]],uida) then
addEvent(pedra, 100, pos,cid,area)
else
e = 0
for i=0,((config.dowpos.y)-(config.uppos.y)) do
e = e-1
addEvent(checkline,100*i,{x=config.uppos.x,y= config.dowpos.y +e,z=config.uppos.z},cid,config.item)
end
creation = nil
config.data[1] = false
end
end
local function control_loop(startpos) -- Function by mock
if not config.data[2] then
return
end
local poi = getPlayerStorageValue(config.data[2], score)
if poi == -1 then
setPlayerStorageValue(config.data[2],score, 0)
poi = 0
end
startpos.stackpos = 2
local coisaa = getThingfromPos(startpos)
if not creation then
creation = true
addEvent(pedra, 1000, {x=config.Bloqueo_start.x,y=config.Bloqueo_start.y,z= config.Bloqueo_start.z ,stackpos=1},config.data[2],config.Bloqueos[math.random(1,#config.Bloqueos)])
end
if coisaa.itemid == config.item then
if getPlayerStorageValue(config.data[2], score) > 0 then
db.executeQuery("INSERT INTO `tetris` (`id`, `player`, `score`) VALUES (NULL, '" .. getPlayerGUID(config.data[2]) .. "', '"..getPlayerStorageValue(config.data[2], score).."');")
end
doPlayerSendTextMessage(config.data[2], MESSAGE_STATUS_CONSOLE_ORANGE, '[TETRIS] You lose X( ! You scored ' ..getPlayerStorageValue(config.data[2], score)..' points.')
clean(config.uppos,config.dowpos,2)
clean(config.uppos,config.dowpos,1)
creation = nil
doTeleportThing(config.data[2], config.exit)
config.data[2] = nil
config.data[1] = false
config.data[3] = true
else
addEvent(control_loop, 300, startpos)
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not config.data[2] then
doTeleportThing(cid, config.playerpos)
setPlayerStorageValue(cid, score, 0)
config.data[2] = cid
addEvent(control_loop, 1000,config.Bloqueo_start)
else
doPlayerSendCancel(cid,'[TETRIS] The game is being played, you must wait until it finishes.')
end
return false
end
Or the original script with the queries added:
Lua:
--[[
Tetris system By mock the bear (mtb)
Modified by Cybermaster for PHP Highscores
Email: [email][email protected][/email]
Visit OTland.net ^^
Enjoy ""
]]
local config = {
uppos = {x=1003,y=1010,z=7},
dowpos = {x=1009,y=1020,z=7},
playerpos = {x=1011,y=1017,z=7},
block_start={x=1006,y=1011,z=7},
exit={x=1011,y=1014,z=7},
delay=10,
item=1739,
effects = {
mark=3,
burn=15,
},
blocks = {
--
{
{
{0,1,0},
{1,1,1},
{0,0,0},
},
{
{0,1,0},
{0,1,1},
{0,1,0},
},
{
{0,0,0},
{1,1,1},
{0,1,0},
},
{
{0,1,0},
{1,1,0},
{0,1,0}
}
},
{
{
{1,1,1},
},
{
{1},
{1},
{1},
},
},
--
{
{
{1},
},
},
{
{
{1,1},{1,1},
},
},
},
data={false},
}
local function createItensInArea(item, pos, area) -- Function by mock
local centro = {}
local coisa = {}
centro.y = math.floor(#area/2)+1
for y = 1, #area do
for x = 1, #area[y] do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z}
local items = doCreateItem(item, 1, pos)
table.insert(coisa, 1, items)
end
end
end
return coisa
end
local function removeItensInArea(item, pos, area) -- Function by mock
local centro = {}
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z,stackpos = 255}
local coisa = getThingfromPos(pos)
if coisa.itemid == item then
doRemoveItem(coisa.uid,1)
end
end
end
end
end
local function checkItensInArea(item, pos, area,coisas) -- Function by mock
local centro = {}
if coisas == nil then
coisas = {}
end
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
number = area[y][x]
if number > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
local pos = {x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z,stackpos = 1}
local coisa = getThingfromPos(pos)
if coisa.itemid == item then
if not isInArray(coisas, coisa.uid) then
return true
end
end
end
end
end
return false
end
function clean(pos1,pos2,stack) -- Function by mock
for x = 0, math.floor(pos2.x-pos1.x) do
for y = 0, math.floor(pos2.y-pos1.y) do
local coisa = getThingfromPos({x = pos1.x+x, y = pos1.y+y, z = pos1.z, stackpos = stack})
if coisa.itemid == config.item then
doRemoveItem(coisa.uid,1)
end
end
end
end
local function pushdown(pos1,pos2,item) -- push all piece 1 sqm to down
-- Function by mock
local ymax = math.floor(pos2.y-pos1.y)
for y = 1,ymax do
for x = 1, math.floor(pos2.x-pos1.x)-1 do
local coisa = getThingfromPos({x = pos1.x+x, y = pos1.y+(ymax-y), z = pos1.z, stackpos = 1})
if coisa.itemid == item then
local p2 = getThingPos(coisa.uid)
doRemoveItem(coisa.uid,1)
p2.y = p2.y+1
doCreateItem(item, 1, p2)
end
end
end
end
local function checkline(pos,cid,item) -- Function by mock
local sizex = config.dowpos.x-config.uppos.x-1
local t = {}
for x=1,sizex do
local using = {x=pos.x+x,y=pos.y,z=pos.z,stackpos=1}
local igz = getThingfromPos(using)
if igz.itemid == item then
table.insert(t,1,{using,igz.uid})
end
end
if #t == sizex then
setPlayerStorageValue(cid,21451, getPlayerStorageValue(cid, 21451)+1)
for i=1,#t do
local f = t[i]
doRemoveItem(f[2],1)
if config.effects.burn then
doSendMagicEffect(f[1],config.effects.burn)
end
end
pushdown(config.uppos,{x=config.dowpos.x,y=pos.y,z =config.dowpos.z},item)
checkline(pos,cid,item)
end
end
function doSendMagicEffectInArea(pos,effect,area,cid) -- Function by mock
local centro = {}
centro.y = math.floor(table.getn(area)/2)+1
for y = 1, table.getn(area) do
for x = 1, table.getn(area[y]) do
if area[y][x] > 0 then
centro.x = math.floor(table.getn(area[y])/2)+1
if type(effect) == 'table' then
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},(effect[area[y][x]] or 0),cid)
else
doSendMagicEffect({x=pos.x+x-centro.x,y=pos.y+y-centro.y,z= pos.z},effect or 0,cid)
end
end
end
end
return true
end
local function pedra(pos,cid,area) -- Function by mock
config.data = config.data or {}
config.data[6] = config.data[6] or config.delay
config.data[5] = config.data[5] or 1
config.data[5] = config.data[5]+1
if config.data[1] == false then
config.data[1] = #area == 1 and 1 or math.random(1,#area)
end
local cre_pos = getCreaturePosition(cid)
pos.stackpos = 255
pos.y = pos.y-1
if getThingfromPos(pos).itemid == config.item then
removeItensInArea(config.item,pos, area[config.data[1]])
end
if config.data[5] >= config.data[6] then
pos.y = pos.y+1
config.data[5] = 1
end
pos.stackpos = 1
if cre_pos.x == config.playerpos.x+1 then
doTeleportThing(cid, config.playerpos)
pos.x = pos.x+1
local coisa2 = getThingfromPos(pos)
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.x = pos.x-1
doSendAnimatedText(cre_pos, "Block", math.random(1,255))
end
elseif cre_pos.x == config.playerpos.x and cre_pos.y == config.playerpos.y+1 then
doTeleportThing(cid, config.playerpos)
pos.y = pos.y+1
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.y = pos.y-1
doSendAnimatedText(cre_pos, "Block", math.random(1,255))
end
elseif cre_pos.x == config.playerpos.x and cre_pos.y == config.playerpos.y-1 then
doTeleportThing(cid, config.playerpos)
if #area > 1 then
local rot = #area < config.data[1]+1 and 1 or config.data[1]+1
if checkItensInArea(463,pos, area[rot]) or checkItensInArea(config.item,pos, area[rot]) then
doSendAnimatedText(cre_pos, "Block", math.random(1,255))
else
config.data[1] = rot
end
end
elseif cre_pos.x == config.playerpos.x-1 then
doTeleportThing(cid, config.playerpos)
pos.x = pos.x-1
local coisa2 = getThingfromPos(pos)
if checkItensInArea(463,pos, area[config.data[1]]) or checkItensInArea(config.item,pos, area[config.data[1]]) then
pos.x = pos.x+1
doSendAnimatedText(cre_pos, "Block", math.random(1,255))
end
end
if config.data[3] then
config.data[3] = nil
return
end
pos.stackpos=1
if getThingfromPos(pos).itemid == config.item then
if getPlayerStorageValue(cid, score) > 0 then
db.executeQuery("INSERT INTO `tetris` (`id`, `player`, `score`) VALUES (NULL, '" .. getPlayerGUID(cid) .. "', '"..getPlayerStorageValue(cid, score).."');")
end
doPlayerSendTextMessage(config.data[2], 24, 'You lose!')
clean(config.uppos,config.dowpos,2)
clean(config.uppos,config.dowpos,1)
creation = nil
doTeleportThing(config.data[2], config.exit)
config.data[2] = nil
config.data[1] = false
config.data[3] = true
return
end
local uida = createItensInArea(config.item,pos, area[config.data[1]])
if config.effects.mark then
doSendMagicEffectInArea(pos,config.effects.mark, area [config.data[1]] )
end
local humrox = pos
pos.y = pos.y+1
if not checkItensInArea(463,pos, area[config.data[1]]) and not checkItensInArea(config.item,humrox, area[config.data[1]],uida) then
addEvent(pedra, 100, pos,cid,area)
else
e = 0
for i=0,((config.dowpos.y)-(config.uppos.y)) do
e = e-1
addEvent(checkline,100*i,{x=config.uppos.x,y= config.dowpos.y +e,z=config.uppos.z},cid,config.item)
end
creation = nil
config.data[1] = false
end
end
local function control_loop(startpos) -- Function by mock
if not config.data[2] then
return
end
doSendMagicEffect(getCreaturePosition(config.data[2]), 1)
local poi = getPlayerStorageValue(config.data[2], 21451)
if poi == -1 then
setPlayerStorageValue(config.data[2],21451, 0)
poi = 0
end
doSendAnimatedText(getCreaturePosition(config.data[2]), "points: "..poi, math.random(1,255))
startpos.stackpos = 2
local coisaa = getThingfromPos(startpos)
if not creation then
creation = true
addEvent(pedra, 1000, {x=config.block_start.x,y=config.block_start.y,z= config.block_start.z ,stackpos=1},config.data[2],config.blocks[math.random(1,#config.blocks)])
end
if coisaa.itemid == config.item then
if getPlayerStorageValue(config.data[2], score) > 0 then
db.executeQuery("INSERT INTO `tetris` (`id`, `player`, `score`) VALUES (NULL, '" .. getPlayerGUID(config.data[2]) .. "', '"..getPlayerStorageValue(config.data[2], score).."');")
end
doPlayerSendTextMessage(config.data[2], 24, 'You lose!')
clean(config.uppos,config.dowpos,2)
clean(config.uppos,config.dowpos,1)
creation = nil
doTeleportThing(config.data[2], config.exit)
config.data[2] = nil
config.data[1] = false
config.data[3] = true
else
addEvent(control_loop, 300, startpos)
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not config.data[2] then
doTeleportThing(cid, config.playerpos)
setPlayerStorageValue(cid,21451, 0)
config.data[2] = cid
addEvent(control_loop, 1000,config.block_start)
else
doPlayerSendCancel(cid,'Tetris are in use. Please wait.')
end
return false
end
Step 3) Finally, the PHP stuff
For Gesior AAC:
a) Add these pictures into htdocs/images/
View attachment tetris.rar
b) Add this to index.php
PHP:
case "tetris";
$topic = "Tetris";
$subtopic = "tetris";
include("tetris.php");
break;
b) Create htdocs/tetris.php
PHP:
<?PHP
//Tetris Highscores. Scripted by Cybermaster. For Gesior AAC.
$record = $SQL->query('
SELECT `p`.`name` AS `name`, `p`.`id` AS `id`, `player`,`score`
FROM `tetris` LEFT JOIN `players` p ON `tetris`.`player` = `p`.`id`
ORDER BY `score` DESC LIMIT 1')->fetch();
$main_content .='<center><img src="images/tetris.png" width="60%" height="60%"</center><br/>
<center><table border="0" cellspacing="0" cellpadding="4" width="40%">
<tr BGCOLOR="'.$config['site']['vdarkborder'].'"><td style="text-align: left; font-weight: bold; font-size:small">CURRENT RECORD</td><td></td></tr> ';
$main_content .= '<tr BGCOLOR="'.$config['site']['darkborder'].'"><td><span style="font-size:large;"><strong><script>
var text="'.$record['name'].'" // YOUR TEXT
var speed=100 // SPEED OF FADE
if (document.all || document.getElementById) {
document.write(\'<span id="highlight">\' + text + \'</span>\')
var storetext=document.getElementById ? document.getElementById("highlight") : document.all.highlight
var hex = new Array("00","14","28","3C","50","64","78","8C","A0","B4","C8","DC","F0")
var r=1
var g=1
var b=1
var seq=1
function changetext2() {
rainbow = "#"+hex[r]+hex[g]+hex[b]
storetext.style.color=rainbow
}
function change() {
if (seq==6) {
b--
if (b==0) {
seq=1
}
}
if (seq==5) {
r++
if (r==12) {
seq=6
}
}
if (seq==4) {
g--
if (g==0) {
seq=5
}
}
if (seq==3) {
b++
if (b==12) {
seq=4
}
}
if (seq==2) {
r--
if (r==0) {
seq=3
}
}
if (seq==1){
g++
if (g==12) {
seq=2
}
}
changetext2()
}
if (document.all || document.getElementById) {
flash = setInterval("change()", speed)
}
}
</script></strong></span><br/> ' . $record['score'] . ' points</a></td><td><img src="images/tetris2.gif"></td></tr></table>';
/*================================================================================================================*/
$main_content .='<br/><center><table border="0" cellspacing="0" cellpadding="2" width="50%">
<tr BGCOLOR="'.$config['site']['vdarkborder'].'">
<td width="10%" class="white" style="text-align: left; font-weight: bold;"></td>
<td width="60%" class="white" style="text-align: left; font-weight: bold;">Player</td>
<td width="10%" class="white" style="text-align: left; font-weight: bold;">Score</td>
</tr> ';
$i = 0;
foreach($SQL->query('SELECT `p`.`name` AS `name`, `tetris`.`id`, `player`,`score` FROM `tetris` LEFT JOIN `players` p ON `tetris`.`player` = `p`.`id` ORDER BY `id` DESC LIMIT 15') as $result)
{
$i++;
$main_content .= '<tr class="over" bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '">
<td style="text-align: left;">' . $i . '</td>
<td><a href="?subtopic=characters&name=' . urlencode($result['name']) . '">' . $result['name'] . '</a></td>
<td style="text-align: center;">' . $result['score'] . '</td></tr>';
}
//PLEASE RESPECT THE COPYRIGHTS. IF YOU APPRECIATE AND USE MY HARD WORK LEAVE IT LIKE IT IS ^^
$main_content .= '</table><br/><br/><div align="right"><span style="font-size:smaller;text-align:left">Script by <a href="http://otland.net/members/cybershot/">Cybermaster</a></span></div>';
?>
For Modern AAC:
a) Add these pictures into htdocs/public/images/
View attachment tetris.rar
b) Create this new page in Modern AAC's Admin Panel
PHP:
<?php
//Script by Cybermaster
//Tetris Highscores Page for Modern AAC
//OTland.net
require("config.php");
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
$record = $SQL->query('
SELECT `p`.`name` AS `name`, `p`.`id` AS `id`, `player`,`score`
FROM `tetris` LEFT JOIN `players` p ON `tetris`.`player` = `p`.`id`
ORDER BY `score` DESC LIMIT 1')->fetch();
echo'<div style="text-align: center; font-weight: bold">Tetris Highscores in '.$config['server_name'].'</div>
<center><img src="'.WEBSITE.'/public/images/tetris.png" width="50%" height="50%"/></center><br/>
<center><table border="0" cellspacing="0" cellpadding="4" width="40%">
<tr bgcolor="lightgray"><td style="text-align: left; font-weight: bold; font-size:medium">CURRENT RECORD</td><td></td></tr>
<tr bgcolor="white"><td><span style="font-size:large;"><strong><script>
var text="'.$record['name'].'" // YOUR TEXT
var speed=100 // SPEED OF FADE
if (document.all || document.getElementById) {
document.write(\'<span id="highlight">\' + text + \'</span>\')
var storetext=document.getElementById ? document.getElementById("highlight") : document.all.highlight
var hex = new Array("00","14","28","3C","50","64","78","8C","A0","B4","C8","DC","F0")
var r=1
var g=1
var b=1
var seq=1
function changetext2() {
rainbow = "#"+hex[r]+hex[g]+hex[b]
storetext.style.color=rainbow
}
function change() {
if (seq==6) {
b--
if (b==0) {
seq=1
}
}
if (seq==5) {
r++
if (r==12) {
seq=6
}
}
if (seq==4) {
g--
if (g==0) {
seq=5
}
}
if (seq==3) {
b++
if (b==12) {
seq=4
}
}
if (seq==2) {
r--
if (r==0) {
seq=3
}
}
if (seq==1){
g++
if (g==12) {
seq=2
}
}
changetext2()
}
if (document.all || document.getElementById) {
flash = setInterval("change()", speed)
}
}
</script></strong></span><br/> ' . $record['score'] . ' points</a></td><td><img src="'.WEBSITE.'/public/images/tetris2.gif"></td></tr></table>
';
echo'<br/><center><table border="0" cellspacing="0" cellpadding="2" width="50%">
<tr>
<td width="10%" class="white" style="text-align: left; font-weight: bold;"></td>
<td width="60%" class="white" style="text-align: left; font-weight: bold;">Player</td>
<td width="10%" class="white" style="text-align: left; font-weight: bold;">Score</td>
</tr> ';
$i = 0;
foreach($SQL->query('
SELECT `p`.`name` AS `name`, `tetris`.`id`, `player`,`score`
FROM `tetris` LEFT JOIN `players` p ON `tetris`.`player` = `p`.`id` ORDER BY `id` DESC LIMIT 15') as $result)
{
$i++;
echo'<tr class="highlight"><td style="text-align: left;">' . $i . '</td>
<td><a href="'.WEBSITE.'/index.php/character/view/'.$result['name'].'">'.$result['name'].'</a></td>
<td style="text-align: center;">' . $result['score'] . '</td></tr>'; }
//PLEASE RESPECT THE COPYRIGHTS. IF YOU APPRECIATE AND USE MY HARD WORK LEAVE IT LIKE IT IS ^^
echo '</table><br/><br/><div align="right"><span style="font-size:smaller;text-align:left">Scripted by <a href="http://otland.net/members/cybershot/">Cybermaster</a></span></div>';
URLs for AACs templates
Gesior AAC
PHP:
?subtopic=tetris
Modern AAC
PHP:
index.php/p/v/tetris
That's it :wub: Pleaze comment
PLEASE RESPECT THE COPYRIGHTS. IF YOU APPRECIATE AND USE MY HARD WORK LEAVE IT LIKE IT IS ^^