Vendeliko
Banned User
- Joined
- Dec 3, 2011
- Messages
- 3,087
- Reaction score
- 91
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?
Thanks in advance,
Vendeliko.
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.