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

Remove Redskull PZ

cassiokk

New Member
Joined
Dec 28, 2010
Messages
32
Reaction score
0
im using this code, but it is removing the skull even with pz. How can i make to remove only in protection zone?
local config = {
cost = 10

}
function onSay(cid, words, param, channel)

local nonremskulls = -- These are the skulls it cant remove. If player has any of these, the rune wont work.


{
white = SKULL_WHITE
}


if isInArray(nonremskulls, getPlayerSkullType(cid)) then
doPlayerSendCancel(cid,"You can't remove this type of skull.")
doSendMagicEffect(getPlayerPosition(cid),2)
return
end
if (getAccountPoints(cid) < config.cost) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, not enough premium time - removing red skull costs " .. config.cost .. " premium points.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
else
doRemovePoints(cid,config.cost)
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, thanks for donating!")
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
doSendAnimatedText(getPlayerPosition(cid), "Removed!", 180)
doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
doWriteLogFile("data/logs/buyeditems.txt", "[".. os.date('%d %B %y - %H:%M') .."] ".. getCreatureName(cid) .." bought a redskull remover for "..config.cost.." points.")
return TRUE




end
end
 
Here it is:
Lua:
local config = {
    cost = 10
}

local nonremskulls = {
    white = SKULL_WHITE
} -- These are the skulls it cant remove. If player has any of these, the rune wont work.

function onSay(cid, words, param, channel)

    if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
    doPlayerSendCancel(cid,"You must be in protection zone to use this command.")
    doSendMagicEffect(getPlayerPosition(cid),2)
    return true
    end

    if isInArray(nonremskulls, getPlayerSkullType(cid)) then
    doPlayerSendCancel(cid,"You can't remove this type of skull.")
    doSendMagicEffect(getPlayerPosition(cid),2)
    return true
    end

    if (getAccountPoints(cid) < config.cost) then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, not enough premium time - removing red skull costs " .. config.cost .. " premium points.")
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
    else
    doRemovePoints(cid,config.cost)
    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, thanks for donating!")
    doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
    doSendAnimatedText(getPlayerPosition(cid), "Removed!", 180)
    doPlayerSetSkullEnd(cid, 0, getPlayerSkullType(cid))
    doWriteLogFile("data/logs/buyeditems.txt", "[".. os.date('%d %B %y - %H:%M') .."] ".. getCreatureName(cid) .." bought a redskull remover for "..config.cost.." points.")
    return true
    end

end

Please try it because I don't know what distro you using. I guess 0.3.6. It should work.
I just added only check if player is outside the protection zone, here:
Lua:
    if getTilePzInfo(getCreaturePosition(cid)) == FALSE then
    doPlayerSendCancel(cid,"You must be in protection zone to use this command.")
    doSendMagicEffect(getPlayerPosition(cid),2)
    return true
    end
 
Back
Top