• 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] doPlayerRemoveFrag(cid, count)

Critico

Sexy
Joined
Mar 25, 2010
Messages
370
Reaction score
176
About: The function is to remove amount frags(Player)

Lua:
function doPlayerRemoveFrag(cid, count) -- by vodka
local query,t,k = db.getResult("SELECT `kill_id` FROM `player_killers` WHERE `player_id` = "..getPlayerGUID(cid)),{},0
		if (query:getID() ~= -1) then 
			repeat
			local gs = db.getResult("SELECT `unjustified` FROM `killers` WHERE `id` = "..query:getDataInt("kill_id"))
					if (gs:getDataInt("unjustified") ~= 0) then
						table.insert(t, query:getDataInt("kill_id"))
						k = k +1
					end
			until not query:next() or k >= count  
			query:free()
		end
	for _, frag in pairs(t) do
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` = "..frag)
	end
	return true
end

Talk exemple:

Lua:
function onSay(cid, words, param, channel)
local amount = 2
	if getPlayerFrags(cid) < amount then
		doPlayerSendCancel(cid,"You don't remover your frags.") return true
	end
	doPlayerRemoveFrag(cid, amount)
		doCreatureSay(cid, "Your frags and skulls is cleaned!", 19)
			doSendMagicEffect(getPlayerPosition(cid), 26)
	return true
end
 
how do I install this on my server? and how do I make a global variable as well?
 
Back
Top