• 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&frag remover on 0.3.6?

Hermes

dziwki kola gramy w lola
Joined
Nov 17, 2007
Messages
1,867
Reaction score
14
Location
Poland
Hi there!

I am trying to make skull and frag remover on 0.3.6. But it's not working as it should. It removes skull but frags are still there.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local data = {
		skull = getCreatureSkullType(cid),
		useLog = "true"
	}
	
	if(data.skull == SKULL_RED or data.skull == SKULL_BLACK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your skull has been taken off!")
		doCreatureSetSkullType(cid, SKULL_NONE)
		doRemoveItem(item.uid, 1)
		
		if(getBooleanFromString(data.useLog) == true) then
			doWriteLogFile("./data/logs/removeskull.log", "\nSuccess: " .. getCreatureName(cid))
		end
		
		doPlayerSetRedSkullTicks(cid, -getPlayerRedSkullTicks(cid))
		db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ");")
		db.executeQuery("UPDATE `players` SET `skulltime` = 0 WHERE `id` = " .. getPlayerGUID(cid) .. ";")
		
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
		
	else
		doPlayerSendCancel(cid, "Sorry, you don't have skull.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
	return true
end

I have no idea how it works now.
Maybe someone knows..? :D

Thanks in advance,
Hermes
 
Hey Hermes I'm trying to make some script like yours...

Look...I'm almost sure that these fuctions:
getPlayerRedSkullTicks(cid)
setPlayerRedSkullTicks(cid)

aren't working any more...and I think that these fuctions worked like it:
db.executeQuery("UPDATE `players` SET `skulltime` = 0 WHERE `id` = " .. getPlayerGUID(cid) .. ";")
 
This simple script will remove Red Skull for premium points - the amount is configurable, as well as effect on succesfull removal. It works with Gesior's AAC shopsystem.

Removing frags doesn't work in 0.3.5, as for some reason they have changed the function for it, or the way it works - dunno since I don't use it.

File: /data/talkactions/scripts/removeskull.lua
LUA:
local exstorage = 1499
-- how many premium points are needed to take off the red skull
local COST = 20
-- "yes" or "no" // should it also remove all frags?
local REMOVE_FRAGS = "yes"
-- effect to use // you can find the list in data/lib/constant.lua
local EFFECT = CONST_ME_YELLOW_RINGS

function onSay(cid, words, param, channel)
    if (exhaustion.check(cid, exstorage) == true) then
        doPlayerSendCancel(cid, "You are exhausted")
        return false
    end
    
    if getCreatureSkullType(cid) == SKULL_RED then
        local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
        local points = query:getDataInt("premium_points")

        if points >= COST then
            local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points - COST).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
            if (update == true) then            
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your red skull has been taken off!\nRemaining premium points: " .. (points - COST))
                doCreatureSetSkullType(cid, SKULL_NONE)
                doWriteLogFile("./data/logs/removeskull.log", "Success: " .. getCreatureName(cid))
                if (REMOVE_FRAGS == "yes") then
                    doPlayerSetRedSkullTicks(cid, 0)
                end
                doSendMagicEffect(getPlayerPosition(cid), effect)
            else
                doPlayerSendCancel(cid, "Database error")
            end
           
        else
            doPlayerSendCancel(cid, "You need " ..COST.. " premium points to remove red skull")
        end
    else
        doPlayerSendCancel(cid, "You do not have red skull")
    end
    exhaustion.set(cid, exstorage, 30)
    
    if (query ~= nil) then
        query:free()
    end
    
    return TRUE
   
end

File: /data/talkactions/talkactions.xml

Code:
<talkaction words="!removeskull" event="script" value="removeskull.lua"/>

03-11-2009: changed the query:free() placement so that it won't show up errors. Also changed topic title that it's for 0.3.4. I didn't think they'd change the way it works in 0.3.5 but seems like I was wrong. As I don't use it yet I'll update the script when I do.

credits goto nsanee

Rep++ :D
 
It works, but it do not remove the frags!

Error:
[13/01/2010 16:10:18] [Error - TalkAction Interface]
[13/01/2010 16:10:18] data/talkactions/scripts/removeskull.lua:onSay
[13/01/2010 16:10:18] Description:
[13/01/2010 16:10:18] data/talkactions/scripts/removeskull.lua:26: attempt to call global 'doPlayerSetRedSkullTicks' (a nil value)
[13/01/2010 16:10:18] stack traceback:
[13/01/2010 16:10:18] data/talkactions/scripts/removeskull.lua:26: in function <data/talkactions/scripts/removeskull.lua:9>
 
Back
Top