iRack Posted March 15, 2019 Share Posted March 15, 2019 Hi ! Can someone help me with a command. When I type [/heal <Name> <Price>] to give that player heal 100% and to take from the player some money. Please ! Thanks a lot ! Link to comment
Mr.Loki Posted March 15, 2019 Share Posted March 15, 2019 addCommandHandlergetPlayerFromPartialName -- custom code (must be added to your code for it to work)getPlayerMoneysetPlayerMoneygetPedStat -- 24 for the ped's max healthsetElementHealth 1 Link to comment
holuzs Posted March 15, 2019 Share Posted March 15, 2019 (edited) -- Copy to 'server.lua' function healPlayer(player, cmd, name, price) if not name or not price then outputChatBox("/heal [Player_Name] [Price]", player, 255, 255, 255, true) else local target = getPlayerFromName(name) if target then if getPlayerMoney(target)>=tonumber(price) then takePlayerMoney(target, tonumber(price)) givePlayerMoney(player, tonumber(price)) setElementHealth(target, 100) outputChatBox(getPlayerName(player) .. " healed you!", player, 255, 255, 255, true) outputChatBox("You healed " .. getPlayerName(target), player, 255, 255, 255, true) else outputChatBox("Can't pay the healing", player, 255, 255, 255, true) end else outputChatBox("I can't find the target!", player, 255, 255, 255, true) end end addCommandHandler("heal", healPlayer) -- Copy to 'meta.xml' <meta> <script src="server.lua" type="server"/> </meta> Edited March 15, 2019 by holuzs 1 Link to comment
iRack Posted March 15, 2019 Author Share Posted March 15, 2019 Thanks a lot guys ! Thanks ! :) 1 Link to comment
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