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

Vip Test

Joined
Sep 29, 2009
Messages
224
Reaction score
0
The bug: If i make 10 characteres in a same account, i can add 10 vip days ;S

Viptest.lua
Code:
function onSay(cid, words, param, channel)
level = getPlayerLevel(cid)
sto = 399710
lvmin = 150
if getPlayerStorageValue(cid, sto) == -1 and level >= lvmin then
doPlayerAddPremiumDays(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce ganhou 1 dia de VIP para TEST, Aproveite!!.")
setPlayerStorageValue(cid, sto, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
elseif level < lvmin then
doPlayerSendCancel(cid, "Voce precisa de level ".. lvmin .." para testar a VIP.")
elseif getPlayerStorageValue(cid, sto) > 0 then
doPlayerSendCancel(cid, "Voce ja testou a sua VIP.")
end
end
 
i have the solution to your problem but may be different depending on the version of tfs you use

first your problem is because your script is limiting a player to do the talkaction, but the vip days are stored in the account so if you made 40 characters then you get 40 days for all of them.

SOLUTION:

first in the database in SQL you execute this

SQL:
ALTER TABLE accounts ADD COLUMN testvip INT DEFAULT 0

ok now every player that haven't used the test (from now) has a "0" in that column

now modify the script to:

Lua:
-- Made by Tymofek, hope it works on the first TRY!!!
function onSay(cid, words, param, channel)

local level = getPlayerLevel(cid)
local lvmin = 150
local yesMsg = "Voce ganhou 1 dia de VIP para TEST, Aproveite!!."
local lvlMsg = "Voce precisa de level ".. lvmin .." para testar a VIP."
local noMsg = "Voce ja testou a sua VIP."
 
 
test = assert(con:execute("SELECT `testvip` FROM `accounts` WHERE `id` = "..getPlayerAccountId(cid)..";"))
vip = test:fetch({}, "a")
 
	if #vip == 0 and level >= lvmin then
		doPlayerAddPremiumDays(cid, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, yesMsg )
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
 
	elseif level < lvmin then
		doPlayerSendCancel(cid, lvlMsg )
 
	elseif #vip > 0 then
		doPlayerSendCancel(cid, noMsg)
	end
end
 
Last edited:
Lua:
-- Made by Tymofek, hope it works on the first TRY!!!
function onSay(cid, words, param, channel)
 
local level = getPlayerLevel(cid)
local lvmin = 150
local yesMsg = "Voce ganhou 1 dia de VIP para TEST, Aproveite!!."
local lvlMsg = "Voce precisa de level ".. lvmin .." para testar a VIP."
local noMsg = "Voce ja testou a sua VIP."
 
 
test = db.getResult("SELECT `testvip` FROM `accounts` WHERE `id` = "..getPlayerAccountId(cid)..";")
vip =  test:getDataInt("testvip")
 
	if vip == 0 and level >= lvmin then
		doPlayerAddPremiumDays(cid, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, yesMsg )
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
db.executeQuery("UPDATE `accounts` SET  `testvip` = 1 WHERE `id` = "..getPlayerAccountId(cid)..";")
 
	elseif level < lvmin then
		doPlayerSendCancel(cid, lvlMsg )
 
	elseif vip > 0 then
		doPlayerSendCancel(cid, noMsg)
	end
end
 
Last edited:
Back
Top