- Joined
- Jun 19, 2009
- Messages
- 1,852
- Reaction score
- 5
Thanks everyone
Last edited:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 123456,
charges = 3,
charge_storage = 234567,
message_type = MESSAGE_INFO_DESCR,
}
if getPlayerStorageValue(cid, cfg.charge_storage) == -1 or getPlayerStorageValue(cid, cfg.charge_storage) == 0 then
setPlayerStorageValue(cid, cfg.charge_storage, charges)
end
if getPlayerStorageValue(cid, cfg.storage) == -1 then
setPlayerStorageValue(cid, cfg.storage, 0)
end
if getPlayerStorageValue(cid, cfg.storage) == cfg.charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, cfg.storage, 0)
end
if isInArray(cfg.noRemove, cfg.playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if cfg.playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, cfg.storage) <= cfg.charges 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)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, cfg.storage, getPlayerStorageValue(cid, cfg.storage)+1)
setPlayerStorageValue(cid, cfg.charge_storage, getPlayerStorageValue(cid, cfg.charge_storage)-1)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed! You have " .. getPlayerStorageValue(cid, cfg.charge_storage) .. " charges left.")
else
doPlayerSendCancel(cid, "Something is wrong")
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 123456,
charges = 3,
charge_storage = 234567,
message_type = MESSAGE_INFO_DESCR,
}
if getPlayerStorageValue(cid, cfg.charge_storage) == -1 or getPlayerStorageValue(cid, cfg.charge_storage) == 0 then
setPlayerStorageValue(cid, cfg.charge_storage, charges)
end
if getPlayerStorageValue(cid, cfg.storage) == -1 then
setPlayerStorageValue(cid, cfg.storage, 0)
end
if isInArray(cfg.noRemove, cfg.playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if cfg.playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, cfg.storage) <= cfg.charges 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)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, cfg.storage, getPlayerStorageValue(cid, cfg.storage)+1)
setPlayerStorageValue(cid, cfg.charge_storage, getPlayerStorageValue(cid, cfg.charge_storage)-1)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed! You have " .. getPlayerStorageValue(cid, cfg.charge_storage) .. " charges left.")
elseif getPlayerStorageValue(cid, cfg.storage) == cfg.charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, cfg.storage, 0)
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
if isInArray(noRemove, playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
elseif playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
else
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(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
end
local aidd = {
min = 10901,
max = 10903
}
if item.actionid < aidd.min then
doItemSetAttribute(item.uid, "aid", aidd.min)
elseif item.actionid >= aidd.min and item.actionid <= aidd.max then
doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid")+1)
elseif item.actionid >= aidd.max then
doRemoveItem(item.uid)
return TRUE
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
if isInArray(noRemove, playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
elseif playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
else
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! You have " .. aidd.max - aidd.min .. " charges left.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
end
local aidd = {
min = 10901,
max = 10903
}
if item.actionid < aidd.min then
doItemSetAttribute(item.uid, "aid", aidd.min)
elseif item.actionid >= aidd.min and item.actionid <= aidd.max then
doItemSetAttribute(item.uid, "aid", getItemAttribute(item.uid, "aid")+1)
elseif item.actionid >= aidd.max then
doRemoveItem(item.uid)
return TRUE
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 30000
}
if getPlayerStorageValue(cid, v.storage) < 3 or isInArray(v.noRemove, v.playerSkull) then
doPlayerSendCancel(cid, "You may not remove " .. v.playerSkull .. " skull.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
elseif 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!")
doPlayerSendTextMessage(cid, 20, "You have - " .. getPlayerStorageValue(cid, v.storage) .. " charges left.")
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)
end
if getPlayerStorageValue(cid, v.storage) == 3 then
doRemoveItem(item.uid)
end
return true
end
doPlayerSendCancel(cid, "You may not use this one more time.")
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = {
noRemove = {SKULL_WHITE, SKULL_YELLOW},
playerSkull = getCreatureSkullType(cid),
storage = 30001
}
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!")
doPlayerSendTextMessage(cid, 20, "You have " .. getPlayerStorageValue(cid, v.storage) .. " charges left.")
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)
elseif getPlayerStorageValue(cid, v.storage) == 3 then
doRemoveItem(item.uid)
end
return true
end