• 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!

TalkAction ShopGuild Points 100% add in player offline.

Natan Beckman

Well-Known Member
Joined
Aug 1, 2010
Messages
548
Reaction score
52
Location
Teresina-PI/Br
System functions:
- Adds points in all players the guild, even those who are offline.
- The player receives points only once.
- No matter if it enters into another guild or create another character.
- The script is based on one made by
Gesior.pl.
- More this script is totally created by Lukeskywalker.
- The leader of the guild can only run the command once per day.
- Some bug fixes and this is without doubt the GuildPoints most complete of forums.


See scripts:

Create one archive in data/talkactions/scripts name guildpoints.lua:

CODE GUILDPOINTS.LUA TFS 0.4

CODE GUILDPOINTS.LUA TFS 1.0

In script the above configure your rules:
ExecuteIntervalHours = 24,
NeedPlayersOnline = 10,
NeedDiferentIps = 6,
MinLevel = 80,
AddPointsForAcc = 9

Next add in talkactions.xml:
Code:
<talkaction words="!guildpoints" event="script" value="guildpoints.lua"/>

At its database add:
Code:
ALTER TABLE `accounts` ADD `guild_points` INTEGER(11) NOT NULL DEFAULT 0;
Code:
ALTER TABLE `accounts` ADD `guild_points_stats` INT NOT NULL DEFAULT '0';
Code:
ALTER TABLE `guilds` ADD `last_execute_points` INT NOT NULL DEFAULT '0';
Code:
                 CREATE TABLE `z_shopguild_offer`(
                       `id`int(11) NOT NULL auto_increment,
                       `points`int(11) NOT NULL default'0',
                       `itemid1`int(11) NOT NULL default'0',
                       `count1`int(11) NOT NULL default'0',
                       `itemid2`int(11) NOT NULL default'0',
                       `count2`int(11) NOT NULL default'0',
                       `offer_type` varchar(255)default NULL,
                       `offer_description` text NOT NULL,
                       `offer_name` varchar(255) NOT NULL,
                       `pid` INT(11) NOT NULL DEFAULT '0',
                 PRIMARY KEY (`id`))
Code:
                 CREATE TABLE `z_shopguild_history_item`(
                       `id`int(11) NOT NULL auto_increment,
                       `to_name` varchar(255) NOT NULL default'0',
                       `to_account`int(11) NOT NULL default'0',
                       `from_nick` varchar(255) NOT NULL,
                       `from_account`int(11) NOT NULL default'0',
                       `price`int(11) NOT NULL default'0',
                       `offer_id`int(11) NOT NULL default'0',
                       `trans_state` varchar(255) NOT NULL,
                       `trans_start`int(11) NOT NULL default'0',
                       `trans_real`int(11) NOT NULL default'0',
                 PRIMARY KEY (`id`))
Code:
                 CREATE TABLE `z_shopguild_history_pacc`(
                       `id`int(11) NOT NULL auto_increment,
                       `to_name` varchar(255) NOT NULL default'0',
                       `to_account`int(11) NOT NULL default'0',
                       `from_nick` varchar(255) NOT NULL,
                       `from_account`int(11) NOT NULL default'0',
                       `price`int(11) NOT NULL default'0',
                       `pacc_days`int(11) NOT NULL default'0',
                       `trans_state` varchar(255) NOT NULL,
                       `trans_start`int(11) NOT NULL default'0',
                       `trans_real`int(11) NOT NULL default'0',
                 PRIMARY KEY (`id`))
Now go to the web part.

Add in index.php:
PHP:
case "shopguild";
$topic = "Shop Guild";
$subtopic = "shopguild";
include("shopguild.php");
break;

PHP:
case "shopguildadmin";
$subtopic = "shopguildadmin";
$topic = "Shop System";
include("shopguildadmin.php");
break;

Add in config.php:
PHP:
$config['site']['shopguild_system'] = 1;

Add in layouts.php next of ShopOffer:
PHP:
<a href='?subtopic=shopguild'>
  <div id='submenu_shopguild' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
        <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
        <div id='ActiveSubmenuItemIcon_shopguild' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
        <div class='SubmenuitemLabel'>Shop Guild <blink><font size='0'><font color='yellow'>NEW</font></font></blink></div>
        <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>

Add in layouts.php next of ShopAdmin for make sure that you only have access ADM:
PHP:
<a href='?subtopic=shopguildadmin'>
  <div id id='submenu_shopguildadmin' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
    <div class='LeftChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
    <div id='ActiveSubmenuItemIcon_shopguildadmin' class='ActiveSubmenuItemIcon' style='background-image:url(".$layout_name."/images/menu/icon-activesubmenu.gif);'></div>
    <div class='SubmenuitemLabel'><font color=red>! ShopGuild Admin !</font></div>
    <div class='RightChain' style='background-image:url(".$layout_name."/images/general/chain.gif);'></div>
  </div>
</a>

Create the archives how name shopguild.php and shopguildadmin.php add:

shopguild.php
shopguildadmin.php


End!

Credits:
LukeSkywalkwer
Natanael Beckman


Sorry my english!
 
Last edited:
i saw such script before but it's ip check not working just tell (0 ips)
does that one works fine ??

trunk 3884 (0.4)
 
For Gesior 2012:
Command for ADD Items in Shop Guild

Script in data/talkactions/scripts name add_shopguild_talkaction.lua
Lua:
function onSay(cid, words, param, channel)
    local toPos = getCreatureLookPosition(cid) -- this function may not exists in old TFSes :/
    toPos.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
    local params = string.explode(param, ",")
    local price = params[1]
    table.remove(params, 1)
    local desc = table.concat(params,",")
    local name = ''
    local item1 = getThingFromPos(toPos)
    local itemid1 = item1.itemid
    local count1 = item1.type
    local itemid2 = 0
    local count2 = 0

    if(itemid1 == 0 or isCreature(item1.uid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is no moveable item in front of you or there is creature.")
        return true
    end
    if(not price) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must set price.")
        return true
    end
    price = tonumber(price)
    local itemInfo = getItemInfo(itemid1)
    local offer_type = 'item'
    if(isContainer(item1.uid)) then
        local item2 = getContainerItem(item1.uid, 0)
        if(item2.itemid > 0) then
            count1 = getContainerCap(item1.uid)
            itemid2 = item2.itemid
            count2 = item2.type
            offer_type = 'container'
            itemInfo = getItemInfo(itemid2)
        end
    end
    local count1_desc = (count1 > 0) and count1 or 1
    local count2_desc = (count2 > 0) and count2 or 1
    if(itemid2 == 0) then
        name = count1_desc .. 'x ' .. itemInfo.name
    else
        name = count1_desc .. 'x ' .. count2_desc .. 'x ' .. itemInfo.name
    end
    db.executeQuery('INSERT INTO `z_shop_offer` (`id` ,`points` ,`itemid1` ,`count1` ,`itemid2` ,`count2` ,`offer_type` ,`offer_description` ,`offer_name`) VALUES (NULL , ' .. price .. ', ' .. itemid1 .. ', ' .. count1 .. ', ' .. itemid2 .. ', ' .. count2 .. ', \'' .. offer_type .. '\', ' .. db.escapeString(desc) .. ', ' .. db.escapeString(name) .. ');')
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item >> " .. name .. " << added to SMS shop. Price is " .. price .. " premium points.")
    return true
end

For use this command
ADD in talkactions.xml
this line:
Lua:
<talkaction log="yes" words="/addshopguild" access="5" event="script" value="add_shopguild_talkaction.lua"/>

In Game for add:
PHP:
/addshopguild POINTS,DESCRICION
OBS: the item must stay in front of your ADM
 
Last edited by a moderator:
its possible create function doaddguildpoints ?

very good to put in reward chests
 
There are a lot of tutorials like this but the only thing that nobody tought, is that the script doesn't add the item to the player.
Its only the talkactions and site part, but there is no system to give the item to player.
 
shopguildadmin.php -> 177 line

PHP:
$points = $_POST['points'];

to

$points = (int) $_POST['points'];
 
[h=3]Error occured![/h]Error ID: ObjectData::getCustomField - Field guild_points does not exist in data / is not loaded.
More info:

File: /var/www/classes/objectdata.php Line: 52
File: /var/www/pages/shopguild.php Line: 4
File: /var/www/system/load.page.php Line: 7
File: /var/www/index.php Line: 41
 
Error occured!

Error ID: ObjectData::getCustomField - Field guild_points does not exist in data / is not loaded.
More info:

File: /var/www/classes/objectdata.php Line: 52
File: /var/www/pages/shopguild.php Line: 4
File: /var/www/system/load.page.php Line: 7
File: /var/www/index.php Line: 41

classes/account.php

Code:
public $data = array('name' => null, 'password' => null, 'salt' => null, 'premdays' => null, 'lastday' => null, 'email' => null, 'key' => null, 'group_id' => null, 'create_ip' => null, 'create_date' => null, 'premium_points' => null, 'page_access' => null, 'location' => null, 'rlname' => null, 'email_new' => null, 'email_new_time' => null, 'email_code' => null, 'next_email' => null, 'last_post' => null, 'flag' => null[COLOR=#ff0000], 'guild_points' => null[/COLOR]);
Code:
public static $fields = array('id', 'name', 'password', 'salt', 'premdays', 'lastday', 'email', 'key', 'group_id', 'create_ip', 'create_date', 'premium_points', 'page_access', 'location', 'rlname', 'email_new', 'email_new_time', 'email_code', 'next_email', 'last_post', 'flag'[COLOR=#ff0000], 'guild_points'[/COLOR]);
 
classes/account.php

Code:
public $data = array('name' => null, 'password' => null, 'salt' => null, 'premdays' => null, 'lastday' => null, 'email' => null, 'key' => null, 'group_id' => null, 'create_ip' => null, 'create_date' => null, 'premium_points' => null, 'page_access' => null, 'location' => null, 'rlname' => null, 'email_new' => null, 'email_new_time' => null, 'email_code' => null, 'next_email' => null, 'last_post' => null, 'flag' => null[COLOR=#ff0000], 'guild_points' => null[/COLOR]);
Code:
public static $fields = array('id', 'name', 'password', 'salt', 'premdays', 'lastday', 'email', 'key', 'group_id', 'create_ip', 'create_date', 'premium_points', 'page_access', 'location', 'rlname', 'email_new', 'email_new_time', 'email_code', 'next_email', 'last_post', 'flag'[COLOR=#ff0000], 'guild_points'[/COLOR]);

Oh this save me!
Thanks :D
 
For globalevents to receive items :)

Code:
-- Created by Unknown, Fixed by Rac --
GUILDSHOP_MSG_TYPE =18
SQL_interval =30
function onThink(interval, lastExecution)
   local result_plr = db.storeQuery("SELECT * FROM z_ots_guildcomunication")
    if(result_plr ~= false) then
        repeat
            local id = tonumber(result.getDataInt(result_plr, "id"))
            local action = tostring(result.getDataString(result_plr, "action"))
            local delete = tonumber(result.getDataInt(result_plr, "delete_it"))
            local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name")))
            if(cid) then
                local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1"))
                local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2"))
                local container_id = tonumber(result.getDataInt(result_plr, "param3"))
                local container_count = tonumber(result.getDataInt(result_plr, "param4"))
                local add_item_type = tostring(result.getDataString(result_plr, "param5"))
                local add_item_name = tostring(result.getDataString(result_plr, "param6"))
                local received_item = 0
                local full_weight = 0
                if(add_item_type == 'container') then
                    container_weight = getItemWeight(container_id, 1)
                    if(isItemRune(itemtogive_id)) then
                        items_weight = container_count * getItemWeight(itemtogive_id, 1)
                    else
                        items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count)
                    end
                    full_weight = items_weight + container_weight
                else
                    full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    if(isItemRune(itemtogive_id)) then
                        full_weight = getItemWeight(itemtogive_id, 1)
                    else
                        full_weight = getItemWeight(itemtogive_id, itemtogive_count)
                    end
                end
                local free_cap = getPlayerFreeCap(cid)
                if(full_weight <= free_cap) then
                    if(add_item_type == 'container') then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while(iter ~= container_count) do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then
                        doPlayerSendTextMessage(cid, GUILDSHOP_MSG_TYPE, 'You received items '.. add_item_name ..'from OTS guildshop.')
                        db.query("DELETE FROM `z_ots_guildcomunication` WHERE `id` = " .. id .. ";")
                        db.query("UPDATE `z_shopguild_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
                    else
                        doPlayerSendTextMessage(cid, GUILDSHOP_MSG_TYPE, ' '.. add_item_name ..'  from OTS guildshop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
                    end
                else
                    doPlayerSendTextMessage(cid, GUILDSHOP_MSG_TYPE, ' '.. add_item_name ..'  from OTS guildshop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
                end
            end
        until not result.next(result_plr)
        result.free(result_plr)
    end
    return true
end
 
On delete items of guildshop in shopadminguild this error
Code:
Warning: simplexml_load_file(): I/O warning : failed to load external entity "/data/items/items.xml" in C:\xampp\htdocs\pages\shopguildadmin.php on line 95
Could not load items!
 
Back
Top