ViRuZGamiing Posted February 12, 2013 Share Posted February 12, 2013 Hello Community, My Script: function medic(player, cmd, who) local who = getPlayerFromName(who) if getPlayerTeam(player) == getTeamFromName("Medic") then setElementHealth(who, 100) end end addCommandHandler("heal", medic) What I want: The Script works fine but I want to set a Range that only players around me can be healed with this added: else outputChatBox("This player isn't close to you", 0, 0, 225) Thanks for helping already Link to comment
TAPL Posted February 12, 2013 Share Posted February 12, 2013 https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints2D OR https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D Link to comment
ViRuZGamiing Posted February 12, 2013 Author Share Posted February 12, 2013 This looks very difficult, can someone explain the "getDistanceBetweenPoints" Link to comment
Guest Guest4401 Posted February 12, 2013 Share Posted February 12, 2013 local range = 50 addCommandHandler('heal', function(p,c,who) local who = getPlayerFromName(who) if who then local mx,my,mz = getElementPosition(p) local ux,uy,uz = getElementPosition(who) if getDistanceBetweenPoints3D(mx,my,mz,ux,uy,uz) <= range then if getPlayerTeam(p) == getTeamFromName("Medic") then setElementHealth(who, 100) end else outputChatBox("This player is far away",p) end else outputChatBox('Player not found.',p,255,0,0) end end ) Link to comment
ViRuZGamiing Posted February 12, 2013 Author Share Posted February 12, 2013 Thanks for Helping both Link to comment
Guest Guest4401 Posted February 13, 2013 Share Posted February 13, 2013 You're welcome 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