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

Lua Remove frags

Fiodor

Lua & Maps
Joined
Mar 14, 2009
Messages
400
Reaction score
10
Location
Poland
Is in TFS some function, witch removes frags? I found skull remover in internet, but it doesn;t work, because it doesn't remove frags [skull disappears and after relog is again].
function onUse(cid, item, frompos, item2, topos)
local zabieraLadunki = "tak" -- Czy zabiera ladunki runy
local usuwaRedSkulla = "tak" -- Czy usuwa red skulla
if((getPlayerSkullType(cid) ~= SKULL_RED or usuwaRedSkulla == "tak") or getPlayerSkullType(cid) ~= SKULL_GREEN) then
doCreatureSetSkullType(cid, SKULL_NONE)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You don't have any skull now.")
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
doPlayerSetRedSkullTicks(cid, 0)
else
doPlayerSendCancel(cid,"You can't remove red or green skull.")
end
if(zabieraLadunki == "tak") then
if(item.type > 1) then
doChangeTypeItem(item.uid, item.type-1)
else
doRemoveItem(item.uid,1)
end
end
end
bad function

TFS Crying Damson 0.3.5
 
From LUA_FUNCTIONS on 0.3.5pl1:

Lua:
	//do*
	doCreatureAddHealth(cid, health[, force])
	doCreatureAddMana(cid, mana)
	doCreatureSetDropLoot(cid, doDrop)
	doCreatureSetSkullType(cid, skull)
	doCreatureSetSpeakType
	doCreatureSetLookDirection(cid, dir)
	doPlayerSetMaxCapacity(cid, cap)
	doCreatureChangeOutfit(cid, outfit)
	doCreatureSay(uid, text, type[, ghost = false[, cid = 0[, pos]]])
	doCreatureSetNoMove(cid, cannotMove)
	doSetCreatureLight(cid, lightLevel, lightColor, time)
	doSetCreatureOutfit(cid, outfit, time)
	doRemoveCreature(cid[, executeLogout = true])
	doMoveCreature(cid, direction)
	doConvinceCreature(cid, target)
	doChallengeCreature(cid, target)
	doChangeSpeed(cid, delta)
	doSummonMonster(name, pos)
	doCreateMonster(name, pos)
	doMonsterChangeTarget(cid)
	doMonsterSetTarget(cid, target)
	doCreateNpc(name, pos)
	doSetMonsterOutfit(cid, name, time)
	doPlayerBroadcastMessage(cid, message[, type])
	doPlayerSetSex(cid, newSex)
	doPlayerSetTown(cid, townid)
	doPlayerSetVocation(cid, voc)
	doPlayerSetStorageValue(uid, key, newValue)
	doPlayerSetGroupId(cid, newGroupId)
	doPlayerSetPromotionLevel(cid, level)
	doPlayerSetStamina(cid, minutes)
	doPlayerSetBalance(cid, balance)
	doPlayerSetExtraExpRate(cid, value)
	doPlayerSetPartner(cid, guid)
	doPlayerRemoveItem(cid, itemid, count[, subtype])
	doPlayerAddExperience(cid, amount)
	doPlayerSetGuildId(cid, id)
	doPlayerSetGuildRank(cid, rank)
	doPlayerSetGuildNick(cid, nick)
	doPlayerAddOutfit(cid,looktype, addons)
	doPlayerRemoveOutfit(cid,looktype, addons)
	doPlayerSetRedSkullTicks(cid, amount)		-- Here it is
	doPlayerSetLossPercent(cid, lossType, newPercent)
	doPlayerSetLossSkill(cid, doLose)
	doPlayerAddSkillTry(cid, skillid, n)
	doPlayerAddSpentMana(cid, amount)
	doPlayerAddSoul(cid, soul)
	doPlayerAddItem(uid, itemid[, count/subtype[, canDropOnMap = true]])
	doPlayerAddItemEx(cid, uid[, canDropOnMap = false])
	doPlayerSendTextMessage(cid, MessageClasses, message)
	doPlayerSendChannelMessage(cid, author, message, SpeakClasses, channel)
	doPlayerSendToChannel(cid, targetId, SpeakClasses, message, channel[, time])
	doPlayerAddMoney(cid, money)
	doPlayerRemoveMoney(cid, money)
	doPlayerTransferMoneyTo(cid, target, money)
	doPlayerPopupFYI(cid, message)
	doPlayerSendTutorial(cid, id)
	doPlayerAddMapMark(cid, pos, type[, description])
	doPlayerAddPremiumDays(cid, days)
	doPlayerAddBlessing(cid, blessing)
	doPlayerAddStamina(cid, minutes)
	doPlayerResetIdleTime(cid)
	doPlayerLearnInstantSpell(cid, name)
	doPlayerUnlearnInstantSpell(cid, name)
	doPlayerFeed(cid, food)
	doPlayerSendCancel(cid, text)
	doPlayerSendDefaultCancel(cid, ReturnValue)
	doPlayerSetRate(cid, type, value)
	doPlayerJoinParty(cid, lid)
	doPlayerSendOutfitWindow(cid)
	doPlayerSave(cid[, shallow = false])
	doCreateItem(itemid, type/count, pos)
	doCreateItemEx(itemid[, count/subtype])
	doAddContainerItemEx(uid, virtuid)
	doAddContainerItem(uid, itemid[, count/subtype])
	doChangeTypeItem(uid, newtype)
	doDecayItem(uid)
	doRemoveItem(uid[, count])
	doTransformItem(uid, toitemid[, count/subtype])
	doSetItemActionId(uid, actionid)
	doSetItemText(uid, text[, writer[, date]])
	doSetItemSpecialDescription(uid, desc)
	doSetItemOutfit(cid, item, time)
	doSetItemProtection(uid, value)
	doTileAddItemEx(pos, uid)
	doTileQueryAdd(uid, pos[, flags])
	doAddCondition(cid, condition)
	doRemoveCondition(cid, type[, subId])
	doRemoveConditions(cid[, onlyPersistent])
	doAreaCombatHealth(cid, type, pos, area, min, max, effect)
	doTargetCombatHealth(cid, target, type, min, max, effect)
	doAreaCombatMana(cid, pos, area, min, max, effect)
	doTargetCombatMana(cid, target, min, max, effect)
	doAreaCombatCondition(cid, pos, area, condition, effect)
	doTargetCombatCondition(cid, target, condition, effect)
	doAreaCombatDispel(cid, pos, area, type, effect)
	doTargetCombatDispel(cid, target, type, effect)
	doCombat(cid, combat, param)
	doTeleportThing(cid, newpos[, pushmove = true])
	doCreateTeleport(itemid, topos, createpos)
	doSendMagicEffect(pos, type[, player])
	doSendDistanceShoot(frompos, topos, type[, player])
	doSendAnimatedText(pos, text, color[, player])
	doShowTextDialog(cid, itemid, text)
	doRelocate(pos, toPos)
	doBroadcastMessage(message, type)
	doWaypointAddTemporial(name, pos)
	doSetGameState(stateId)
	doAddIpBanishment(ip[, length[, comment[, admin]]])
	doAddNamelock(name[, reason[, action[, comment[, admin]]]])
	doAddBanishment(accId[, length[, reason[, action[, comment[, admin]]]]])
	doAddDeletion(accId[, reason[, action[, comment[, admin]]]]])
	doAddNotation(accId[, reason[, action[, comment[, admin]]]]])
	doRemoveIpBanishment(ip[, mask])
	doRemoveNamelock(name)
	doRemoveBanisment(accId)
	doRemoveDeletion(accId)
	doRemoveNotations(accId)
	doSaveServer()
	doReloadInfo(id[, cid])
	doCleanHouse(houseId)
	doCleanMap()
	doRefreshMap()

The function is there mate, are you sure thats the error?
 
When that function is in script - skull remover rune doesn't disappear after using, but when I deleted that function, rune disappeared

That's why I think something isn't ok
 
The script you posted on the first post has some typos but hey can you translate this to english:

Lua:
	local zabieraLadunki = "tak" -- Czy zabiera ladunki runy
	local usuwaRedSkulla = "tak" -- Czy usuwa red skulla

Im remaking the script but I dont really get what are those locals there or what are they even for.

And is this script for a rune or an item?
 
It's for rune, id for example 2270

local zabieraLadunki = "tak" -- Czy zabiera ladunki runy
local removesCharges = "yes" -- does it remove charges from rune?
local usuwaRedSkulla = "tak" -- Czy usuwa red skulla
local removesRedSkull = "yes" - does it remove red skull?
 
PHP:
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doPlayerSetSkullEnd(cid, 0, SKULL_RED)

Rep++
 
PHP:
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doPlayerSetSkullEnd(cid, 0, SKULL_RED)

Rep++

Good job, +Repped (Edit: Cant +rep you for a while, I think I +repped you sometime earlier). I was having a hard time trying to find where frags were stored, but didnt even know that "killers" existed lol, silly me.

Anyways this function:

PHP:
doPlayerSetSkullEnd(cid, 0, SKULL_RED)

Im guessing it is for donators svn cause pl1 doesnt have it ;/

Anyways here's the working script with Koob's addition on it:

/data/actions.xml:

PHP:
<action itemid="2270" event="script" value="fragremove.lua"/>

/data/actions/scripts/fragremove.lua:

Lua:
function onUse(cid, item, frompos, item2, topos)
	local removesCharges = "yes" -- does it remove charges from rune?
	
	local nonremskulls = 	-- These are the skulls it cant remove. If player has any of these, the rune wont work.
{
	red = SKULL_RED,
	green = SKULL_GREEN,
	black = SKULL_BLACK
}

	if isInArray(nonremskulls, getPlayerSkullType(cid)) then
		doPlayerSendCancel(cid,"You can't remove this type of skull.")
		doSendMagicEffect(getPlayerPosition(cid),2)
	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 have been removed.")
		doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
	return TRUE
	end
	
	if(removesCharges == "yes") then
		if(item.type > 1) then
			doChangeTypeItem(item.uid, item.type-1)
		else
			doRemoveItem(item.uid,1)
		return TRUE
	end
end
end

Only thing is removeCharges doesnt work, Ill get into it later and fix it but Im in a rush right now. Dont forget to +rep Koob.

PS: I didnt really test if it doesnt work with the skulls from the array, will test when Im back, but Idk if it will work cause Im just starting to code with arrays lol.

Cheers.
 
Last edited:
Anyways this function:

PHP:
doPlayerSetSkullEnd(cid, 0, SKULL_RED)

Im guessing it is for donators svn cause pl1 doesnt have it ;/

How do you know p1 dont have it ? Maybe that function isnt documented? Dunno, but look on luascript.h from p1:

PHP:
static int32_t luaDoPlayerSetSkullEnd(lua_State* L);
 
I edited it a little bit and now it's deleting it on use, but there's no option to turn it back on xD

Code:
  function onUse(cid, item, frompos, item2, topos)
       
        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)
        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)
                doRemoveItem(item.uid, 1)
        return TRUE
        end
end
 
Last edited by a moderator:
How do you know p1 dont have it ? Maybe that function isnt documented? Dunno, but look on luascript.h from p1:

PHP:
static int32_t luaDoPlayerSetSkullEnd(lua_State* L);

Hmm well it isnt documented maybe they forgot to put it or it is still unstable to use I guess. Anyways I think I tried putting it and didnt work but dont remember, Ill try again when Im home.
 
Code:
function onUse(cid, item, frompos, item2, topos)
       
        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)
        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, thanks for donating!")
                doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_RED)
				doSendAnimatedText(getPlayerPosition(cid), "Removed!", 180)
                doRemoveItem(item.uid, 1)
        return TRUE
        end
end
 
Back
Top