• 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 Frag System 0.3.6

HeberPcL

[PowerOT.com.br]
Joined
Aug 21, 2007
Messages
1,294
Reaction score
54
Location
Brazil
GitHub
heberpcl
How to fix code for working in 0.3.6_SVN

PHP:
local config = {
	fragTime = getConfigInfo('timeToDecreaseFrags')
}

function onSay(cid, words, param, channel)
	local fragstatus = getPlayerStorageValue(cid,3943)
	local fragsPvP = getPlayerStorageValue(cid,3944)
	local amount = getPlayerRedSkullTicks(cid)
	local frags = math.floor((amount / config.fragTime) + 1)
	local remainingTime = math.floor(amount - (config.fragTime * (frags - 1)))
	local hours = math.floor(((remainingTime / 1000) / 60) / 60)
	local minutes = math.floor(((remainingTime / 1000) / 60) - (hours * 60))
		
	if(amount > 0 and config.fragTime > 0) then
		if (fragstatus > 1) and (fragsPvP > 1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Frags: " .. fragstatus .. "] [Arena PVP: " .. fragsPvP .. "]You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m.")
		elseif (fragsPvP > 1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Arena PVP: " .. fragsPvP .. "] You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m.")
		elseif (fragstatus > 1) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Frags: " .. fragstatus .. "] You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m.")
		end
	end
	return TRUE
end

Error:
PHP:
[Error - TalkAction Interface]
data/talkactions/scripts/tools/frags.lua:onSay
Description:
data/talkactions/scripts/tools/frags.lua:8: attempt to call global 'getP
layerRedSkullTicks' (a nil value)
stack traceback:
        data/talkactions/scripts/tools/frags.lua:8: in function <data/ta
lkactions/scripts/tools/frags.lua:5>
:(
 
Code:
local config = {
	fragTime = getConfigInfo('timeToDecreaseFrags')
}
function onSay(cid, words, param, channel)
	local fragstatus, fragsPvP, amount = getPlayerStorageValue(cid,3943), getPlayerStorageValue(cid,3944), getPlayerSkullTicks(cid, SKULL_RED)
	local frags = math.floor((amount / config.fragTime) + 1)
	local remainingTime = math.floor(amount - (config.fragTime * (frags - 1)))
	local hours = math.floor(((remainingTime / 1000) / 60) / 60)
	local minutes = math.floor(((remainingTime / 1000) / 60) - (hours * 60))
	if(amount > 0 and config.fragTime > 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (fragstatus > 1 and fragsPvP > 1) and "[Frags: " .. fragstatus .. "] [Arena PVP: " .. fragsPvP .. "]You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m." or fragsPvP > 1 and "[Arena PVP: " .. fragsPvP .. "] You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m." or fragstatus > 1 and "[Frags: " .. fragstatus .. "] You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m." or "You have " .. frags .. " unjustified frag" .. (frags > 2 and "s" or "") .. ". The amount of unjustified frags will decrease after: " .. hours .. "h and " .. minutes .. "m.")
	end
	return TRUE
end
 
09:05 You currently have 20 frags today, 20 this week and 20 this month.
09:05 Last frag at 18 February 2011 03:31:28 on level 111 (Demond Druid).
09:05 Your red skull will expire at 18 February 2011 13:31:28

help me my frags not down
 
Back
Top