ViRuZGamiing Posted February 12, 2013 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 "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
TAPL Posted February 12, 2013 Posted February 12, 2013 https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints2D OR https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D
ViRuZGamiing Posted February 12, 2013 Author Posted February 12, 2013 This looks very difficult, can someone explain the "getDistanceBetweenPoints" "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Guest Guest4401 Posted February 12, 2013 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 )
ViRuZGamiing Posted February 12, 2013 Author Posted February 12, 2013 Thanks for Helping both "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
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