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

Buy Items With Frags [REQUEST] REP++ for the Helper

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,707
Reaction score
32
I Want a new system on my WarOT, I Want people to be able to buy Stuff with their Frags.

When they say !buylist. a buylist will appear on the console, showing the offers


1# Golden Boots [20 Frags]
2#Magic Sword [30 frags]
3#Chain Helmet [10 frags]
4#Blessed Shield [5 frags]
5#Wand of Voodoo [30 frags]

And then they say like for example: !buy Wand of Voodoo

And a message will appear: You have bought a Wand of Voodoo for 30 frags.

And then 30 frags will dissapear from the player, REP++ For the guy who helps me.

This is a very hard script..
 
Last edited:
PHP:
local config = {
Frags = 30,
Item = xxxx,
MsgBuy = "You have bought a Wand of Voodoo for 30 frags",
MsgBuyStats = "Status: Buyed",
MsgNoMoney = "Sorry, you don't have enough frags."
}
function onSay(cid, words, param)
if getPlayerFlags(cid, config.Frags) == 1 then
doPlayerAddItem(cid,config.Item,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,config.MsgBuy)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,config.MsgBuyStats)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_YALAHARIGHOST)
else
doPlayerSendCancel(cid,config.MsgNoMoney)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return TRUE
end


not tested.
 
Last edited:
Code:
local items =
	{
		[1234] = {
			frags = 5,
			item = xxxx,
			count = 1
		},
		[2345] = {
			frags = 30,
			item = xxxx9,
			count = 1
		},
	}

function buyItems(cid, items)
	if getPlayerFlags(cid) == items.frags then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You buy a " .. getItemName(items.item) .. ".")
		doPlayerAddItem(cid, items.item, items.count)
	end
end

function onUse(cid, item, frompos, item2, topos)
	if items[item.aid] ~= nil then
		buyItems(cid, items[item.aid])
	end
	return TRUE
end
 
Last edited:
Code:
local items =
	{
		[1234] = {
			frags = 5,
			item = xxxx,
			count = 1
		},
		[2345] = {
			frags = 30,
			item = xxxx9,
			count = 1
		},
	}

function buyItems(cid, items)
	if getPlayerFlags(cid) == items.frags then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You buy a " .. getItemName(items.item) .. ".")
		doPlayerAddItem(cid, items.item, items.count)
	end
end

function onUse(cid, item, frompos, item2, topos)
	if items[item.aid] ~= nil then
		buyItems(cid, items[item.aid])
	end
	return TRUE
end


1 Question, You forgot to add the !buylist. word so the list will appear
 
local config = {
5Frags = Blessed Shield,
10Frags = Chain Helmet,
20Frags = Golden Boots,
30Frags = Magic Sword,
30sFrags = Wand of Voodoo
}

function onSay(cid, words, param)
if(param == "buylist") then
doPlayerPopupFYI(cid, "Items List:\n\n5 Frags: " .. config.5Frags .. "\n10 Frags: " .. config.10Frags .. "\n20 Frags: " .. config.10Frags .. "\n30 Frags: " .. config.30Frags .. "\n30 Frags: " .. config.30sFrags .. "
return TRUE
end


Not Tested. hope it work S:
 
PHP:
local frags = {
   --[Frags] = {ItemId}
    [5] = {2173},
    [10] = {2268}
            }
function onSay(cid, words, param) 
 if words == "!list" then
        text = "<--List of valid frags-->"
        line = "\n"
        for frag, item in pairs(frags) do
            text = text .. line .. "Item: "..getItemNameById(item[1])..", Frags = "..frag..""
        end
        doPlayerPopupFYI(cid, text)
    end
    return TRUE
end

You just need to add your item frags in "local frags"

the number between [] is the amount of frags and the number from {} is the item id.

PD: You just need to add the number id in {} and it will take the name from itemID
 
Code:
local frags = {
   --[Frags] = {ItemId}
    [5] = {2523},
    [10] = {6531}
    [20] = {2646},
    [30] = {2400}
    [30] = {7424}
            }
function onSay(cid, words, param) 
 if words == "!list" then
        text = "<--List of valid frags-->"
        line = "\n"
        for frag, item in pairs(frags) do
            text = text .. line .. "Item: "..getItemNameById(item[1])..", Frags = "..frag..""
        end
        doPlayerPopupFYI(cid, text)
    end
    return TRUE
end

And still..

[01/03/2009 21:32:34] Warning: [Event::loadScript] Can not load script. data/actions/scripts/other/potions.lua
[01/03/2009 21:32:34] data/actions/scripts/Frags.lua:5: '}' expected (to close '{' at line 1) near '['
 
Missing ","
PHP:
local frags = {
   --[Frags] = ItemId
    [5] = 2523,
    [10] = 6531,
    [20] = 2646,
    [30] = 2400,
    [30] = 7424
            }
function onSay(cid, words, param) 
 if words == "!list" then
        text = "<--List of valid frags-->"
        line = "\n"
        for frag, item in pairs(frags) do
            text = text .. line .. "Item: "..getItemNameById(item)..", Frags = "..frag..""
        end
        doPlayerPopupFYI(cid, text)
    end
    return TRUE
end
 
Missing ","
PHP:
local frags = {
   --[Frags] = ItemId
    [5] = 2523,
    [10] = 6531,
    [20] = 2646,
    [30] = 2400,
    [30] = 7424
            }
function onSay(cid, words, param) 
 if words == "!list" then
        text = "<--List of valid frags-->"
        line = "\n"
        for frag, item in pairs(frags) do
            text = text .. line .. "Item: "..getItemNameById(item)..", Frags = "..frag..""
        end
        doPlayerPopupFYI(cid, text)
    end
    return TRUE
end


The script didn't get any error reports when i reloaded it, But it didn't work either when i said "!list" ingame..
 
None, ;SS [02/03/2009 15:58:21] Reloaded talkactions.

BUT STILL IT'S BUGGED, IT WONT WORK! could u add my msn?
[email protected] and we can fixx it live, much faster.. after that u can remove me haha ;D
 
Back
Top