- Joined
- Jun 19, 2009
- Messages
- 1,852
- Reaction score
- 5
Thanks everyone
Last edited:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 30050
}
if isInArray(v.noRemove, v.playerSkull) then
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, v.storage) < 3 then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, v.storage, getPlayerStorageValue(cid, v.storage)+1)
doPlayerSendTextMessage(cid, 20, "You have " .. -(getPlayerStorageValue(cid, v.storage)) .. " charges left.")
elseif getPlayerStorageValue(cid, v.storage) == 3 then
doRemoveItem(item.uid)
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 30061
}
if isInArray(v.noRemove, v.playerSkull) then
return doPlayerSendCancel(cid, "You may not remove this kind of skull.") and doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, v.storage) < 3 then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, v.storage, getPlayerStorageValue(cid, v.storage)+1)
doPlayerSendTextMessage(cid, 20, "You have " .. -(getPlayerStorageValue(cid, v.storage)) + 1 .. " charges left.")
end
if getPlayerStorageValue(cid, v.storage) == 3 then
doRemoveItem(item.uid)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getPlayerSkullType(cid)
local storage = 4003
local t = 3022
local firstUse = 34343
if getPlayerStorageValue(cid, firstUse) == -1 then
setPlayerStorageValue(cid, firstUse, 1)
setPlayerStorageValue(cid, storage, 4)
end
if not isInArray(noRemove, playerSkull) and getPlayerStorageValue(cid, firstUse) == 1 then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
setPlayerStorageValue(cid, t, getPlayerStorageValue(cid, t)+1)
doPlayerSendTextMessage(cid, 20, "You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
else
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
end
if getPlayerStorageValue(cid, t) == 3 then
doRemoveItem(item.uid)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local action = 5000
local charges = 3
if not getItemAttribute(item.uid, "aid") then
doItemSetAttribute(item.uid, "aid", action)
end
if not isInArray(noRemove, getPlayerSkullType(cid)) then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid")-1)
doPlayerSendTextMessage(cid, 20, "You have " .. getItemAttribute(item.uid, "aid")-action+charges .. " charges left.")
else
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
end
if getItemAttribute(item.uid, "aid") == action-charges then
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local action = 5000
local charges = 3
if not getItemAttribute(item.uid, "aid") then
doItemSetAttribute(item.uid, "aid", action)
end
if not isInArray(noRemove, getCreatureSkullType(cid)) then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid")-1)
doPlayerSendTextMessage(cid, 20, "You have " .. getItemAttribute(item.uid, "aid")-action+charges .. " charges left.")
else
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
end
if getItemAttribute(item.uid, "aid") == action-charges then
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_RED, SKULL_BLACK}
local playerSkull = getPlayerSkullType(cid)
local storage = 4003
local t = 3022
local firstUse = 34343
if getPlayerStorageValue(cid, firstUse) == -1 then
setPlayerStorageValue(cid, firstUse, 1)
setPlayerStorageValue(cid, storage, 4)
end
if isInArray(noRemove, playerSkull) and getPlayerStorageValue(cid, firstUse) == 1 then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)-1)
setPlayerStorageValue(cid, t, getPlayerStorageValue(cid, t)+1)
doPlayerSendTextMessage(cid, 20, "You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
else
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
end
if getPlayerStorageValue(cid, t) == 3 then
doRemoveItem(item.uid)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local action = 5000
local charges = 3
if not getItemAttribute(item.uid, "aid") then
doItemSetAttribute(item.uid, "aid", action)
end
if getCreatureSkullType(cid) < 4 and getCreatureSkullType(cid) > 0 then
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doCreatureSetSkullType(cid, 0)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed!")
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getThingPos(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid")-1)
doPlayerSendTextMessage(cid, 20, "You have " .. getItemAttribute(item.uid, "aid")-action+charges .. " charges left.")
else
doPlayerSendCancel(cid, "You may not remove this kind of skull.")
end
if getItemAttribute(item.uid, "aid") == action-charges then
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, 20, "You ran out of charges.")
end
return true
end