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

Frag Remover - Whats Wrong?

Vendeliko

Banned User
Joined
Dec 3, 2011
Messages
3,087
Reaction score
90
Location
Beside that guy with that thing but without that t
Hey guys,i've added a item remove chance when used to my frag remover and it works perfect except that when a player uses the frag remover and has no skull,has red skull etc nothing happens but when the player uses it and it breaks the msg pops up and it gets removed,could any of ye please look at this script and tell me whats incorrect in it?

Code:
function onUse(cid, item, frompos, item2, topos)
if math.random(100) < 15 then
doPlayerRemoveItem(cid, 9969, 1)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Unfortunately, the skull remover broke!")
        local noRemove = {SKULL_WHITE, SKULL_YELLOW}
        local playerSkull = getPlayerSkullType(cid)
        elseif isInArray(noRemove, playerSkull) then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not remove this type of skull.")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            return true
        elseif playerSkull == SKULL_NONE then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have any skull!")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            return true
elseif playerSkull == {SKULL_RED, SKULL_BLACK} then
                db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your frags and skull have been succesfully removed!")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
            doSendAnimatedText(getPlayerPosition(cid), "Poof!", 180)
            doCreatureSetSkullType(cid,0)
            doPlayerSetSkullEnd(cid, 0, playerSkull)
            doPlayerRemoveItem(cid, 9969, 1)
        end
        return true
end

Thanks in advance,
Vendeliko.
 
Try this
Lua:
function onUse(cid, item, frompos, item2, topos)

	if math.random(100) < 15 then
		doPlayerRemoveItem(cid, 9969, 1)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Unfortunately, the skull remover broke!")
		return false
	end

        local noRemove = {SKULL_WHITE, SKULL_YELLOW}
        local playerSkull = getPlayerSkullType(cid)
        if isInArray(noRemove, playerSkull) then
        	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not remove this type of skull.")
        	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        	return true
	end

        if playerSkull == SKULL_NONE then 
            	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have any skull!")
            	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            	return true
	end

	if playerSkull == SKULL_RED or playerSkull == SKULL_BLACK then
                db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
            	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your frags and skull have been succesfully removed!")
            	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
            	doSendAnimatedText(getPlayerPosition(cid), "Poof!", 180)
            	doCreatureSetSkullType(cid,0)
            	doPlayerSetSkullEnd(cid, 0, playerSkull)
            	doPlayerRemoveItem(cid, 9969, 1)
        end
        return true
end
 
Don't forget to mention it's 0.2 based on TFS 0.2.14 9.6
But so far as I know a function for removing skull doesn't exist in that server.
 
Back
Top