- Joined
- Jun 19, 2009
- Messages
- 1,852
- Reaction score
- 5
Thanks everyone
Last edited:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 5
if getPlayerStorageValue(cid, storage) < 0 then
setPlayerStorageValue(cid, storage, 0)
return true
if getPlayerStorageValue(cid, storage) == 5 then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
end
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
elseif getPlayerStorageValue(cid, storage) <= charges and getPlayerStorageValue(cid, storage) >= 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(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1)
end
end
end
return true
end
Dunno if it works xD I was kinda confused when I made it because friends screaming in skypeLua:function onUse(cid, item, fromPosition, itemEx, toPosition) local noRemove = {SKULL_WHITE, SKULL_YELLOW} local playerSkull = getCreatureSkullType(cid) local storage = 123456 local charges = 5 if getPlayerStorageValue(cid, storage) < 0 then setPlayerStorageValue(cid, storage, 0) return true if getPlayerStorageValue(cid, storage) == 5 then doPlayerRemoveItem(cid, item.uid, 1) setPlayerStorageValue(cid, storage, 0) end 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 elseif getPlayerStorageValue(cid, storage) <= charges and getPlayerStorageValue(cid, storage) >= 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(getPlayerPosition(cid), CONST_ME_MAGIC_RED) doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180) doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid)) setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1) end end end return true end
EDIT; Shouldn't SKULL_GREEN be there too?
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 3
local message_type = MESSAGE_INFO_DESCR
if getPlayerStorageValue(cid, storage) < 0 then
setPlayerStorageValue(cid, storage, 0)
return true
if getPlayerStorageValue(cid, storage) == charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
end
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
elseif getPlayerStorageValue(cid, storage) <= charges and getPlayerStorageValue(cid, storage) >= 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! You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1)
end
end
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 3
local message_type = MESSAGE_INFO_DESCR
if getPlayerStorageValue(cid, storage) < 0 then
setPlayerStorageValue(cid, storage, 0)
return true
elseif getPlayerStorageValue(cid, storage) == charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
return true
elseif 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
elseif getPlayerStorageValue(cid, storage) <= charges and getPlayerStorageValue(cid, storage) >= 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! You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1)
end
return true
end
[1:34:30.929] [Error - LuaInterface::loadFile] data/actions/scripts/other/fremov
e.lua:12: 'end' expected (to close 'if' at line 8) near 'if'
[1:34:30.929] [Warning - Event::loadScript] Cannot load script (data/actions/scr
ipts/other/fremove.lua)
[1:34:30.929] data/actions/scripts/other/fremove.lua:12: 'end' expected (to clos
e 'if' at line 8) near 'if'
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 3
local message_type = MESSAGE_INFO_DESCR
if getPlayerStorageValue(cid, storage) < 0 then
setPlayerStorageValue(cid, storage, 0)
return true
if getPlayerStorageValue(cid, storage) == charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
return true
if isInArray(noRemove, playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
if playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
if getPlayerStorageValue(cid, storage) <= 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)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed! You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1)
else
doPlayerSendCancel(cid, "Something is wrong")
end
end
end
end
end
return true
end
[1:43:21.428] [Error - LuaInterface::loadFile] data/actions/scripts/other/fremov
e.lua:12: 'end' expected (to close 'if' at line 8) near 'if'
[1:43:21.428] [Warning - Event::loadScript] Cannot load script (data/actions/scr
ipts/other/fremove.lua)
[1:43:21.428] data/actions/scripts/other/fremove.lua:12: 'end' expected (to clos
e 'if' at line 8) near 'if'
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 3
local message_type = MESSAGE_INFO_DESCR
if getPlayerStorageValue(cid, storage) < 0 then
setPlayerStorageValue(cid, storage, 0)
end
if getPlayerStorageValue(cid, storage) == charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
end
if isInArray(noRemove, playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, storage) <= 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)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed! You have " .. getPlayerStorageValue(cid, storage) .. " charges left.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "POFF!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
setPlayerStorageValue(cid, getPlayerStorageValue(cid, storage)+1)
else
doPlayerSendCancel(cid, "Something is wrong")
end
return true
end
01:52 Your frags & your skull have been removed! You have 0 charges left.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local noRemove = {SKULL_WHITE, SKULL_YELLOW}
local playerSkull = getCreatureSkullType(cid)
local storage = 123456
local charges = 3
local charge_storage = 234567
local message_type = MESSAGE_INFO_DESCR
if getPlayerStorageValue(cid, charge_storage) == -1 or getPlayerStorageValue(cid, charge_storage) == 0 then
setPlayerStorageValue(cid, charge_storage, charges)
end
if getPlayerStorageValue(cid, storage) == -1 then
setPlayerStorageValue(cid, storage, 0)
end
if getPlayerStorageValue(cid, storage) == charges then
doPlayerRemoveItem(cid, item.uid, 1)
setPlayerStorageValue(cid, storage, 0)
end
if isInArray(noRemove, playerSkull) then
doPlayerSendCancel(cid, "You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if playerSkull == SKULL_NONE then
doPlayerSendCancel(cid, "You don't have skull.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
if getPlayerStorageValue(cid, storage) <= 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, getPlayerStorageValue(cid, storage)+1)
setPlayerStorageValue(cid, getPlayerStorageValue(cid, charge_storage)-1)
doPlayerSendTextMessage(cid, 27, "Your frags & your skull have been removed! You have " .. getPlayerStorageValue(cid, charge_storage) .. " charges left.")
else
doPlayerSendCancel(cid, "Something is wrong")
end
return true
end