Hello,
So i got my ruppee to ap working, But say i have 2.5b in my inventory and i hit the 3b exchange. it takes my 2.5b and put me at a -500m in my inventory. But if i try it again it tells me sorry not enough gold. Anyone know how to fix this?
dlg_title( "Ruppee > Arena Points" )
dlg_text( "Hi there, would you like to exchange your ruppees to arena points?" )
dlg_menu( "300,000,000 Ruppees = 10,000 AP", "gold2ap(10,1)" )
dlg_menu( "750,000,000 Ruppees = 25,000 AP", "gold2ap(25,1)" )
dlg_menu( "1,500,000,000 Ruppees = 50,000 AP", "gold2ap(50,1)" )
dlg_menu( "2,225,000,000 Ruppees = 75,000 AP", "gold2ap(75,1)" )
dlg_menu( "3,000,000,000 Ruppees = 100,000 AP", "gold2ap(100,1)" )
dlg_menu( "Back", "exchange_arenapoints()" )
dlg_menu("@90010002", "")
dlg_show()
end
function gold2ap(count,lng)
local ap = get_value("ap")
local gold = get_value("gold")
local cost = 30000000 * count
local applus =count * 1000
if gold >= ap then
set_value("ap",ap + applus)
set_value("gold", gold - cost)
message("<#FFFFFF><B>Success! you've paid: "..cost.." for "..applus.."Arena Points.")
--update_gold_chaos()
elseif ap < cost then --determination: if ap is less then the costs
if lng == 0 then
-- no_ap() some arabic ****
elseif lng == 1 then
message("<#CDRFDF><B>Sorry! not anough gold.")
end
end
end
function dlg_return(id)
if id == 1 then
return 'Rupee'
elseif id == 2 then
return 'Holic'
elseif id == 3 then
return 'JP'
else
return 'AP'
end
end
function value_return(id)
if id == 1 then
return 'gold'
elseif id == 2 then
return 'huntaholic_point'
elseif id == 3 then
return 'jp'
else
return 'ap'
end
end
--short explanation:
--this are arrays wich stores the information of the cost or the amount of each trade
--for example we trade rupees for holics ,the cost is
--rupee_holic (1) 10000 rupees for
--holic_rupee (1) 1 holic point
--or we trade ap for jp ,the cost is
--ap_jp (1) 10000 ap for
--jp_ap (1) 50000000 jp
rupee_holic = {10000,50000,100000,500000}
rupee_jp = {1000000,2000000,5000000,10000000}
rupee_ap = {250000000,750000000,1500000000,3000000000}
holic_rupee = {1,5,10,50}
holic_jp = {1,5,10,50}
holic_ap = {1,5,10,50}
jp_rupee = {10000000,20000000,50000000,100000000}
jp_holic = {10000,50000,100000,500000}
jp_ap = {50000000,75000000,150000000,500000000}
ap_rupee = {10000,25000,50000,100000}
ap_holic = {1,5,10,50}
ap_jp = {10000,25000,50000,100000}
--||||||||||||||||||||||||||||||||||||||||||||||||--
-- DONT TOUCH THIS! ;) --
--||||||||||||||||||||||||||||||||||||||||||||||||--
-- this configures the trade options
function price_selector(source,trade,counter)
local cost,amount
cost = 0
amount = 0
if source == 1 then -- trade rupee
if trade == 2 then
cost = rupee_holic[counter]
amount = holic_rupee[counter]
elseif trade == 3 then
cost = rupee_jp[counter]
amount = jp_rupee[counter]
elseif trade == 4 then
cost = rupee_ap[counter]
amount = ap_rupee[counter]
end
end
if source == 2 then -- trade holic
if trade == 1 then
cost = holic_rupee[counter]
amount = rupee_holic[counter]
elseif trade == 3 then
cost = holic_jp[counter]
amount = jp_holic[counter]
elseif trade == 4 then
cost = holic_ap[counter]
amount = ap_holic[counter]
end
end
if source == 3 then -- trade jp
if trade == 1 then
cost = jp_rupee[counter]
amount = rupee_jp[counter]
elseif trade == 2 then
cost = jp_holic[counter]
amount = holic_jp[counter]
elseif trade == 4 then
cost = jp_ap[counter]
amount = ap_jp[counter]
end
end
if source == 4 then -- trade ap
if trade == 1 then
cost = ap_rupee[counter]
amount = rupee_ap[counter]
elseif trade == 2 then
cost = ap_holic[counter]
amount = holic_ap[counter]
elseif trade == 3 then
cost = ap_jp[counter]
amount = jp_ap[counter]
end
end
return cost,amount
end
function exchange_example()
dlg_title("Raskim")
dlg_text("This is an Example how easy all Exchanges can happen.")
for i = 1,4 do -- get a dlg list of the trade options
dlg_menu("Trade "..dlg_return(i),"exchange_select("..i..")")
end
dlg_menu("Nevermind","")
dlg_show()
end
function exchange_select(typ)
dlg_title("Raskim")
dlg_text("You want to exchange your "..dlg_return(typ)..".<br>For What?")
for i = 1,4 do
if i ~= typ then -- make sure you dont do dummy trades (e.g. rupees for rupees)
dlg_menu("Exchange for "..dlg_return(i),"exchange_select_amount("..typ..","..i..")")
end
end
dlg_menu("Return","exchange_example()")
dlg_menu("Nevermind","")
dlg_show()
end
function exchange_select_amount(source,trade)
dlg_title("Raskim")
dlg_text("You want to exchange your "..dlg_return(source).." for "..dlg_return(trade)..".<br>How much?")
for i = 1,4 do --build the trade amount/cost options
local cost,amount = price_selector(source,trade,i)
dlg_menu("Exchange "..cost.." "..dlg_return(source),"exchange_execute_check("..source..","..trade..","..cost..","..amount..")")
end
dlg_menu("Return","exchange_select("..source..")")
dlg_menu("Nevermind","")
dlg_show()
end
--make sure the user REALLY want to do this deal
function exchange_execute_check(source,trade,cost,amount)
local text = tostring("Exchange "..cost.." "..dlg_return(source).." for "..amount.." "..dlg_return(trade).."?")
dlg_special( 'confirm_window', "exchange_select_amount_execute("..source..","..trade..","..cost..","..amount..")", text )
end
--executing of the trade
function exchange_select_amount_execute(source,trade,cost,amount)
if gv(value_return(source)) >= cost then -- if the user has valid options for the trade - do it
if source == 2 then
set_huntaholic_point(gv(value_return(source))-cost)
else
sv(value_return(source),gv(value_return(source))-cost)
end
if trade == 2 then
set_huntaholic_point(gv(value_return(trade))+amount)
else
sv(value_return(trade),gv(value_return(trade))+amount)
end
whisper(gv("name"),"Exchanged "..cost.." "..dlg_return(source).." for "..amount.." "..dlg_return(trade)..".")
contuine_check(source)
else -- otherwise he have to GTFO
whisper(gv("name"),"Failed to Exchange.")
end
end
function contuine_check(source)
dlg_title("Raskim")
dlg_text("Contuine trading your "..dlg_return(source).."?")
dlg_menu("Yes","exchange_select("..source..")")
dlg_menu("Nevermind","")
dlg_show()
end
Well, normally if you have some brain, you should understand what this little snippet does. xD
[Helping Topic] 24/7 Helping Services! 08/27/2008 - EO PServer Hosting - 31 Replies stucked on anything while setuping your server?
post your problem here and you will get answer as fast as possible better than spamming with posts :cool:
first of all try reading Ahmedpotop's Pserver All thing guide.
if your couldn't solve it out post your problem down here
""That includes PHP rankings pages / registrations pages / Status pages""