RevScript PowerGamers

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Hola a todos,

Aqui encontraran el script PowerGamers del Znote, que permite activar la pagina de PowerGamers, Experience obtenida en 24h en la pagina web,

Deberan entrar en su base de datos, clicar en ella y luego ir en Ejecutar SQL, insertaran:

Código:
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';

Una vez ejecutado, de nuevo le daran click en SQL y ejecutaran esta:

Código:
UPDATE `znote_players` AS `z` INNER JOIN `players` AS `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist_lastexp`=`p`.`experience`;

Nos iremos dentro de data/scripts/creaturescripts crearemos una carpeta Znote y le pondremos el script powergamers.lua:

Código:
-- getEternalStorage and setEternalStorage
-- can be added to data/global.lua if you want to use eternal storage for another purpose than this.
-- Regular TFS global storage values get reset every time server reboots. This does not.
local function getEternalStorage(key, parser)
    local value = result.getString(db.storeQuery("SELECT `value` FROM `znote_global_storage` WHERE `key` = ".. key .. ";"), "value")
    if not value then
        if parser then
            return false
        else
            return -1
        end
    end
    result.free(value)
    return tonumber(value) or value
end

local function setEternalStorage(key, value)
    if getEternalStorage(key, true) then
        db.query("UPDATE `znote_global_storage` SET `value` = '".. value .. "' WHERE `key` = ".. key .. ";")
    else
        db.query("INSERT INTO `znote_global_storage` (`key`, `value`) VALUES (".. key ..", ".. value ..");")
    end
    return true
end


local globalevent = GlobalEvent("PowerGamers")

function globalevent.onThink(...)
    if tonumber(os.date("%d")) ~= getEternalStorage(23856) then
        setEternalStorage(23856, (tonumber(os.date("%d"))))
        db.query("UPDATE `znote_players` SET `onlinetime7`=`onlinetime6`, `onlinetime6`=`onlinetime5`, `onlinetime5`=`onlinetime4`, `onlinetime4`=`onlinetime3`, `onlinetime3`=`onlinetime2`, `onlinetime2`=`onlinetime1`, `onlinetime1`=`onlinetimetoday`, `onlinetimetoday`=0;")
        db.query("UPDATE `znote_players` `z` INNER JOIN `players` `p` ON `p`.`id`=`z`.`player_id` SET `z`.`exphist7`=`z`.`exphist6`, `z`.`exphist6`=`z`.`exphist5`, `z`.`exphist5`=`z`.`exphist4`, `z`.`exphist4`=`z`.`exphist3`, `z`.`exphist3`=`z`.`exphist2`, `z`.`exphist2`=`z`.`exphist1`, `z`.`exphist1`=`p`.`experience`-`z`.`exphist_lastexp`, `z`.`exphist_lastexp`=`p`.`experience`;")
    end
    db.query("UPDATE `znote_players` SET `onlinetimetoday` = `onlinetimetoday` + 60, `onlinetimeall` = `onlinetimeall` + 60 WHERE `player_id` IN (SELECT `player_id` FROM `players_online` WHERE `players_online`.`player_id` = `znote_players`.`player_id`)")
    return true
end

globalevent:interval(60000)
globalevent:register()

Incluiremos también la syncronizacion de los outfits para el characterprofile,
Dentro de la carpeta Znote en scripts incluiremos una archivo llamado syncoutfit.lua:

Código:
local creatureevent = CreatureEvent("SincOutfit")

-- Sync outfits that player own with Znote AAC
-- So its possible to see which full sets player
-- has in characterprofile.php

znote_outfit_list = {
    { -- Female outfits
        136, 137, 138, 139, 140, 141, 142, 147, 148,
        149, 150, 155, 156, 157, 158, 252, 269, 270,
        279, 288, 324, 329, 336, 366, 431, 433, 464,
        466, 471, 513, 514, 542, 575, 578, 618, 620,
        632, 635, 636, 664, 666, 683, 694, 696, 698,
        724, 732, 745, 749, 759, 845, 852, 874, 885,
        900, 973, 975, 1020, 1024, 1043, 1050, 1057,
        1070, 1095, 1103, 1128, 1147, 1162, 1174,
        1187, 1203, 1205, 1207, 1211, 1246, 1244,
        1252, 1271, 1280, 1283, 1289, 1293, 1332
    },
    { -- Male outfits
        128, 129, 130, 131, 132, 133, 134, 143, 144,
        145, 146, 151, 152, 153, 154, 251, 268, 273,
        278, 289, 325, 328, 335, 367, 430, 432, 463,
        465, 472, 512, 516, 541, 574, 577, 610, 619,
        633, 634, 637, 665, 667, 684, 695, 697, 699,
        725, 733, 746, 750, 760, 846, 853, 873, 884,
        899, 908, 931, 955, 957, 962, 964, 966, 968,
        970, 972, 974, 1021, 1023, 1042, 1051, 1056,
        1069, 1094, 1102, 1127, 1146, 1161, 1173,
        1186, 1202, 1204, 1206, 1210, 1245, 1243,
        1251, 1270, 1279, 1282, 1288, 1292, 1331
    }
}

function creatureevent.onLogin(player)
    -- storage_value + 1000 storages (highest outfit id) must not be used in other script.
    -- Must be identical to Znote AAC config.php: $config['EQ_shower'] -> storage_value
    local storage_value = 10000
    -- Loop through outfits
    for _, outfit in pairs(znote_outfit_list[player:getSex() + 1]) do
        if player:hasOutfit(outfit,3) then
            if player:getStorageValue(storage_value + outfit) ~= 3 then
                player:setStorageValue(storage_value + outfit, 3)
            end
        end
    end
    return true
end

creatureevent:register()
 
Arriba