yesyesok Posted April 30, 2015 Posted April 30, 2015 $from = "USD"; $to = "GBP"; $amount = 12.50; $url = "http://www.exchangerate-api.com/".$from."/".$to."/".$amount."?k=API_KEY"; $result = file_get_contents($url); echo $result; i was learning php for Mta, what should i do to make it like a command /currency usd gbp and it outputs the result.
ALw7sH Posted April 30, 2015 Posted April 30, 2015 or fetchRemote if you want to get what you did echo for
Walid Posted April 30, 2015 Posted April 30, 2015 function convertMoney(plr, cmd, usd, gbp, amount) if plr and isElement(plr) then if not (tostring(usd)) or not(tostring(gbp)) then outputChatBox("[Wrong Command]: /currency usd gbp ", plr, 0, 255, 0) return end if (not tonumber(amount)) then return end exchangerate(plr,usd,gbp,amount) end end addCommandHandler("currency", convertMoney) function currency_return(sum) if sum ~= "ERROR" then outputChatBox(sum) end end function exchangerate(player,usd,gbp,amount) if (usd and gbp and amount) then return callRemote("<< you php file link >>", currency_return, player, usd,gbp,amount) end end untested Note: as ALw7sH said you must use fetchRemote to get echo (print text) or try to change you php file code.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now