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

[Request]Skull System

bilmattan

evo-Online - Owner
Joined
Aug 5, 2008
Messages
1,316
Reaction score
11
Location
Sweden
Hello!

I'm currently working with a war server and I would need help with a script like this :

If a player got 1-9 frags give him a green skull
If a player got 10-19 frags give him a white skull
and so on.

I'm ready to pay a little for it.


I'm using tfs 0.4 dev.


Thanks,
Max
 
Create this creatureevent:
Lua:
local storage = xxxx
function onKill(cid, target)
	local frags = getPlayerStorageValue(cid, storage)
	if(isPlayer(target)) then
		setPlayerStorageValue(cid, storage, frags+1)
		if(frags < 10) then
			doCreatureSetSkullType(cid, SKULL_GREEN)
		elseif(frags < 20) then
			doCreatureSetSkullType(cid, SKULL_WHITE)
		elseif(frags < 30) then
			doCreatureSetSkullType(cid, SKULL_RED)
		elseif(frags > 39) then
			doCreatureSetSkullType(cid, SKULL_BLACK)
		end
	end
	return true
end
And just add this to your login script anywhere in the onLogin function:
Lua:
	setPlayerStorageValue(cid, xxxx, 0)
And create a new frag checker talkaction and just put this:
Lua:
function onSay(cid, words, param, channel)
	if(getPlayerStorageValue(cid, xxxx) < 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have no frags.")
	elseif(getPlayerStorageValue(cid, xxxx) == 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have 1 frag.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have ".. getPlayerStorageValue(cid, xxxx) .." frags.")
	end
	return true
end

Don't forget to replace the "xxxx" in the onKill function for storage value, and the "xxxx" in the frag checker.
 
Create this creatureevent:
Lua:
local storage = xxxx
function onKill(cid, target)
	local frags = getPlayerStorageValue(cid, storage)
	if(isPlayer(target)) then
		setPlayerStorageValue(cid, storage, frags+1)
		if(frags < 10) then
			doCreatureSetSkullType(cid, SKULL_GREEN)
		elseif(frags < 20) then
			doCreatureSetSkullType(cid, SKULL_WHITE)
		elseif(frags < 30) then
			doCreatureSetSkullType(cid, SKULL_RED)
		elseif(frags > 39) then
			doCreatureSetSkullType(cid, SKULL_BLACK)
		end
	end
	return true
end
And just add this to your login script anywhere in the onLogin function:
Lua:
	setPlayerStorageValue(cid, xxxx, 0)
And create a new frag checker talkaction and just put this:
Lua:
function onSay(cid, words, param, channel)
	if(getPlayerStorageValue(cid, xxxx) < 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have no frags.")
	elseif(getPlayerStorageValue(cid, xxxx) == 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have 1 frag.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have ".. getPlayerStorageValue(cid, xxxx) .." frags.")
	end
	return true
end

Don't forget to replace the "xxxx" in the onKill function for storage value, and the "xxxx" in the frag checker.
Thanks, but this needs source edit since I'm using PVP-E
 
eH? storages? frags :p
Lua:
 local 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
 

Similar threads

Back
Top