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

Lua Script for remove promotion

Elite Brasil

New Member
Joined
Nov 3, 2009
Messages
92
Reaction score
0
I need a script that removes the promotion so vipdays = 0

example: vipdays = 0 and transform promotion in 1


I tried to do a script did not work more

onLogout function (cid)
if (db.getResult ("SELECT` promotion `FROM` players `WHERE` name `= '" .. getCreatureName (cid ).."';") == 2) THEN
if (db.getResult ("SELECT` vipdays `FROM` `WHERE accounts` name `= '" .. getPlayerAccount (cid ).."';") <1) then
db.executeQuery ("UPDATE` players `SET` promotion `= 1 WHERE` name `= '" .. getCreatureName (cid ).."';")
end
end
return TRUE
end



Could someone help?
 
Lua:
function onLogout(cid)
	local a = db.getResult('SELECT `promotion` FROM `players` WHERE `id` = ' .. getPlayerGUID(cid) .. ' LIMIT 1;')
	if a:getDataInt('promotion') == 2 then
		local b = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `name` = '" .. getPlayerAccount(cid) .. "' LIMIT 1;")
		if b:getDataInt('vipdays') < 1 then
			db.executeQuery('UPDATE `players` SET `promotion` = 1 WHERE `id` = ' .. getPlayerGUID(cid) .. ' LIMIT 1;')
		end
		b:free()
	end
	a:free()
	return true
end
 
Last edited:
login.lua
after
Lua:
function onLogin(cid)
add
Lua:
local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info < 1 then
doPlayerSetPromotionLevel(cid, 0)
doPlayerSave(cid, true)
end
and save
 
Back
Top