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

skull system

EL Polako

New Member
Joined
Mar 25, 2009
Messages
153
Reaction score
1
Hello

I need script for my pvp enforced server:

If someone gets
- 50 frags - has all the time white skull
- 100 frags - yellow skull
- 250 frags - green skull
- 600 - red skull
- 1000 - black skull

Thanks in advance
 
CreatureScript - globalevent.

example
Lua:
funtion onThink(interval)
         for _,cid in ipairs(getPlayersOnline()) do
               if frags == w/e then
                      if playerskull ~= white then
                              setskull white
                      end
                end
          end
return true
end
 
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}

local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end

local size = {
day = table.maxn(contents.day),
week = table.maxn(contents.week),
month = table.maxn(contents.month)
}

return size.day + size.week + size.month
end

could u fix it becouse dont work ;/
 
Lua:
function getPlayerFrags(cid)
    local time = os.time()
    local times = {today = (time - 86400), week = (time - (7 * 86400))}
 
    local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
    if(result:getID() ~= -1) then
        repeat
            local content = {date = result:getDataInt("date")}
            if(content.date > times.today) then
                table.insert(contents.day, content)
            elseif(content.date > times.week) then
                table.insert(contents.week, content)
            else
                table.insert(contents.month, content)
            end
        until not result:next()
        result:free()
    end
 
    local size = {
        day = table.maxn(contents.day),
        week = table.maxn(contents.week),
        month = table.maxn(contents.month)
    }
 
    return size.day + size.week + size.month
end

function onThink(interval)
	for _,cid in ipairs(getPlayersOnline()) do
		f = getPlayerFrags(cid)
		if f => 50 and f < 100 then
			if getCreatureSkullType(cid) == 0 then
				doCreatureSetSkullType(cid, 3)
			end
		elseif f => 100 and f < 250 then
			if getCreatureSkullType(cid) == 0 then
				doCreatureSetSkullType(cid, 1)
			end
		elseif f => 250 and f < 600 then
			if getCreatureSkullType(cid) == 0 then
				doCreatureSetSkullType(cid, 2)
			end
		elseif f => 600 and f < 1000 then
			if getCreatureSkullType(cid) == 0 then
				doCreatureSetSkullType(cid, 4)
			end
		elseif f => 1000 then
			if getCreatureSkullType(cid) == 0 then
				doCreatureSetSkullType(cid, 5)
			end
		end
	end
return true
end
 
Last edited:
Doggy noob ja pierdole co nick -.- said:
Code:
if getCreatureSkullType(cid) ~= 3 then
	doCreatureSetSkullType(cid, 3)
end

Why are you checking actual skull? It won't reset skull if it's 3 already, and you're wasting CPU cycles only.
 
Lua:
function onThing

pHtlc.png
 
dunno about 0.3.6, but in 0.4 you'll have to remove script skullcheck.lua located in creatureevents/scripts folder........ because it will remove the skullz..... and you cannot Normal PvP on, because it will give you skulls for attacking ppl etc... Otherwise you'll just need to do what I said, and fix the script from page 1


not sure but i think in 0.4 you can set useFragHandler = false and it will work even in Normal PvP
 
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}

local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end

local size = {
day = table.maxn(contents.day),
week = table.maxn(contents.week),
month = table.maxn(contents.month)
}

return size.day + size.week + size.month
end

function onThink(interval)
for _,cid in ipairs(getPlayersOnline()) do
f = getPlayerFrags(cid)
if f => 50 and f < 100 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 3)
end
elseif f => 100 and f < 250 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 1)
end
elseif f => 250 and f < 600 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 2)
end
elseif f => 600 and f < 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 4)
end
elseif f => 1000 then
if getCreatureSkullType(cid) == 0 then
doCreatureSetSkullType(cid, 5)
end
end
end
return true
end
i think that i will not work.
 
error in console
[15:22:32.604] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/skull.lua:32: 'then' expected near '='
 
Back
Top