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

Ver. 0.1.0 - Gesior ITEM/PACC Shop (PHP+LUA) for TFS

Please somebody HELP ME!
How do I set a storage_value to set VIP on players intead of premdays?
Im running SQL
 
Please somebody HELP ME!
How do I set a storage_value to set VIP on players intead of premdays?
Im running SQL

Just make an item that gives them VIP in actions:


Code:
-- Credits StreamSide, Empty and Kaorus
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 30 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("" ..  name .. " is now a VIP member. For more details, go to our website shop: xx.xx.xx")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end    
return TRUE
end

Then sell that item, 30 days of VIP.
 
Just make an item that gives them VIP in actions:


Code:
-- Credits StreamSide, Empty and Kaorus
function onUse(cid, item, fromPosition, itemEx, toPosition)
local name = getCreatureName(cid)
    -- if getPlayerStorageValue(cid,11551) < 1 then
        if getPlayerLevel(cid) > 1 then
            getPlayerStorageValue(cid, 11551)
            doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
            doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for 30 days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
            doBroadcastMessage("" ..  name .. " is now a VIP member. For more details, go to our website shop: xx.xx.xx")
            setPlayerStorageValue(cid, 11551, (getPlayerStorageValue(cid,11551) + 15))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendCancel(cid,"You need to be at least level 2 to use this.")
            doRemoveItem(item.uid, 1)
        end
    -- else
    --    doPlayerSendCancel(cid,"You are already a donator.")
    -- end    
return TRUE
end

Then sell that item, 30 days of VIP.

Thanks for the idea!
But how can I set this action to discount the account_points like
this GetAccountPoints - Vip_Points on SQL?
 
@Sho System Offer I can pAy for the fix
i can pay for someone if someone can fix the received count in shop system lua files like shop.lua in globalevents, cause only can receive item one by one and sell container offers too, only receive the backpack with only one item inside not the correct count, if someone know how to fix that, plz post here or send me one private msg i can pay for this fix.
Thx to listem me wainting some reply
 
I've got a small problem.
When I buy something via sms shop everything seems to be ok (test1 added to player GOD items (he will get this container with items after relog)).
But when i login into game, theres no information about items or sth.
What should I look for and change?
 
How can I fix this? I use Crying Damson 0.3.5.
In z_ots_comunication it says:
ID: 1
name: Freaked
type: Login
action: Give_item
param1: 2160
param2: 5
param5: Item
param6: 5 crystal coins
delete_it: 1
_________________________________

At step 3 I did as
"OR IF YOU USE NEW VERSION OF TFS 0.3:" says.
Is that correct for version 0.3.5 Crying Damson? It should be right?

I rep you ;)
 
I get this error, what should I do? (Sorry for double post, no edit)

[16/08/2009 17:33:53] Lua Script Error: [GlobalEvent Interface]
[16/08/2009 17:33:53] data/globalevents/scripts/shop.lua:eek:nThink

[16/08/2009 17:33:53] data/globalevents/scripts/shop.lua:15: attempt to call global 'isPlayer' (a nil value)
[16/08/2009 17:33:53] stack traceback:
[16/08/2009 17:33:53] data/globalevents/scripts/shop.lua:15: in function <data/globalevents/scripts/shop.lua:7>
[16/08/2009 17:33:53] [Error - GlobalEvents::think] Couldn't execute event: shop


Help=Rep ;)
 
New error

PHP:
[25/07/2009 14:13:28] Lua Script Error: [CreatureScript Interface] 
[25/07/2009 14:13:28] in a timer event called from: 
[25/07/2009 14:13:28] data/creaturescripts/scripts/login.lua:onLogin

[25/07/2009 14:13:28] data/creaturescripts/scripts/login.lua:47: attempt to index global 'luasql' (a nil value)
[25/07/2009 14:13:28] stack traceback:
[25/07/2009 14:13:28] 	data/creaturescripts/scripts/login.lua:47: in function <data/creaturescripts/scripts/login.lua:45>

im having the same problem... please someone know how to fix? im running TFS 0.3.5p1
 
TFS 0.3 or TFS 0.2.13 npc? You must know LUAsql or new method to connect to database if you use TFS 0.3. I can make function to add points for you.
If you use TFS 0.3 rev. 840+ add this at end of .../data/functions.lua file:
Code:
function addPremiumPoints(cid, value)
	local player_account_id = db.getResult("SELECT `account_id` FROM `players` WHERE `name` = " .. db.escapeString(getCreatureName(cid)) .. ";")
	if(player_account_id:getID() ~= -1) then
		local account_id =  player_account_id:getDataInt("account_id")
		player_account_id:free()
		local player_account = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. account_id .. ";")
		if(player_account:getID() ~= -1) then
			local setpoints = player_account:getDataInt("premium_points") + value
			db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. setpoints .. " WHERE `id` = " .. account_id .. ";")
			player_account:free()
			return TRUE
		end
	end
	return FALSE
end
return TRUE if changed premium days value
return FALSE if not
Use in talkaction:
Code:
function onSay(cid, words, param)
	if getPlayerMoney(cid) >= 5000 then
		if addPremiumPoints(cid, 10) == TRUE then
			doPlayerRemoveMoney(cid, 5000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received 10 premium points for 5000gp.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Error ocurred you don't receive 10 points.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "10 points cost 5000 gp, you don't have enought money.")
	end
end
(tested on TFS 0.3 rev. 900)

I tried using this script. I created a function in talkactions, but failed.

Eu criei o arquivo em data/talkactions/scripts/ chamado points.lua e adicionei o script postado por você. Ainda criei uma linha em data/talkactions/talkactions.xml:
Code:
<talkaction words="!points" event="script" value="points.lua"/>

The Error:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/points.lua:onSay
data/talkactions/scripts/points.lua:3:attempt to call global 'addPremiumPoints' ( a nil value)
stack traceback:
         data/talkactions/scripts/points.lua:3:in function <data/talkactions/scripts/points.lua:1>

Please help-me! Sry for my bad english.
 
Back
Top