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

aol not working , !buy "aol not working :(

Sir Shutter

Learning LUA
Joined
Nov 17, 2008
Messages
1,437
Reaction score
10
Location
Egypt
hey guys on my server im using tfs 0.3 , the aol doesnt work

when i die i dont lose the aol and my bp falls down

also when i say !buy "aol it says invalid item and the script is fine :(

here is the script for !buy "aol

Code:
-----------------------By Nahruto-------------------------- 
-------------------http://otfans.net/---------------------- 
 function getPlayerMoney(cid) 
gold = getPlayerItemCount(cid,2148) 
plat = getPlayerItemCount(cid,2152)*100 
crys = getPlayerItemCount(cid,2160)*10000 
money = gold + plat + crys 
return money 
end 
local items = { 
    ["aol"] = {cash=10000, id=2173, amount=1}, 
    ["food"] = {cash=2000, id=2671, amount=100}, 
    ["backpack"] = {cash=100, id=1988, amount=1} 
}  
---------End Config --------- 
function onSay(cid, words, param) 
bitem = items[param] 
        if (bitem ~= nil) then 
            if getPlayerMoney(cid) >= bitem.cash then 
                doPlayerAddItem(cid,bitem.id,bitem.amount) 
                doPlayerRemoveMoney(cid,bitem.cash) 
            else 
                doPlayerSendCancel(cid,"Sorry, you dont have enough money") 
            end 
        else 
            doPlayerSendCancel(cid, "Invalid item.")             
        end 
return 1 
end

plz help i give rep
 
I dunno if this script are same but try this :


-----------------------By Nahruto--------------------------
-------------------http://otfans.net/----------------------
function getPlayerMoney(cid)
gold = getPlayerItemCount(cid,2148)
plat = getPlayerItemCount(cid,2152)*100
crys = getPlayerItemCount(cid,2160)*10000
money = gold + plat + crys
return money
end
local items = {
["aol"] = {cash=30000, id=2173, amount=1},
["food"] = {cash=2000, id=2671, amount=100},
["backpack"] = {cash=100, id=1988, amount=1}
}
---------End Config ---------
function onSay(cid, words, param)
bitem = items[param]
if (bitem ~= nil) then
if getPlayerMoney(cid) >= bitem.cash then
doPlayerAddItem(cid,bitem.id,bitem.amount)
doPlayerRemoveMoney(cid,bitem.cash)
else
doPlayerSendCancel(cid,"Sorry, you dont have enough money")
end
else
doPlayerSendCancel(cid, "Invalid item.")
end
return 1
end
 
<item id="2173" article="an" name="amulet of loss">
<attribute key="weight" value="420"/>
<attribute key="slotType" value="necklace"/>
<attribute key="preventLoss" value="1"/>
</item>
 
Remeber if you changed Pvp = pvpenforced in the config, the aol dosent work.
(i dont know what its named on the config beacuse i dont got my config file)
 
PHP:
<attribute key="preventLoss" value="1"/>
to
PHP:
<attribute key="preventDrop" value="1"/>
		<attribute key="charges" value="1"/>

Yep, what Zonet said should fix your AOL.

Im using TFS 0.3.2 and this is a simple script I made for the command !buyaol, it sure is not even close as good or clean as Nahruto's one but well I r n00bak at scripting. Well this works for me, maybe it can work for ya.

buyaol.lua
PHP:
function onSay(cid, words, param)
		if doPlayerRemoveMoney(cid, 20000) == TRUE then
			doPlayerAddItem(cid,2173,1)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought 1 Amulet Of Loss for 20k. If you want it cheaper (10k) go buy it from a NPC.")
		else
				doPlayerSendCancel(cid, "You don't have enough money, 1 AOL costs 20k when you buy it using this command. If you buy it from a NPC it is 10k.")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
		end
end

And in talkactions.xml:
Code:
<talkaction words="!buyaol" event="script" value="buyAOL.lua"/>
Cheers~
 
Back
Top