PaulDK Posted May 26, 2014 Share Posted May 26, 2014 Hey Guys i want to know the functions and example how to do script of give Armor and give Health . example if i type /givearmor [name or id] it will gives 100% armor and if i type /givehealth [name or id] it will gives 100% life+ outputChatBox("[sERVER] [PlayerName who gaves armor or health] have been given you 100% health or Armor.") then if you type /giveall [name or id] it will gives 100% armor and 100% health. + outputChatbox("[sERVER] [PlayerName who gaves armor and health] have been given you 100% armor and 100% health !") Thanks in Advance dude please give me example of the script. Thanks i hope you will help me ! Link to comment
#RooTs Posted May 26, 2014 Share Posted May 26, 2014 try this Meta.xml "YOGA" type="script" version="1.0.0" /> Server.lua function buyhealth ( thePlayer ) local money = getPlayerMoney ( thePlayer ) if money >= 250 then local thePlayerhealth = getElementHealth ( thePlayer ) setElementHealth ( thePlayer, 100 ) else end end addCommandHandler ( "health", buyhealth ) --================================= function buyarmor ( thePlayer ) local money = getPlayerMoney ( thePlayer ) if money >= 500 then local thePlayerarmor = getPedArmor(thePlayer) setPedArmor ( thePlayer, 100 ) else end end addCommandHandler ( "armor", buyarmor ) Link to comment
#RooTs Posted May 26, 2014 Share Posted May 26, 2014 or try this Server.lua function buyhealth ( thePlayer ) outputChatBox ('message health chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) end end addCommandHandler ( "health", buyhealth ) --======================= function buyarmor ( thePlayer ) outputChatBox ('message armor chatbox', root, 255, 255, 255, true) setPedArmor ( thePlayer, 100 ) end end addCommandHandler ( "armor", buyarmor ) --====================== function HealthArmor ( thePlayer ) outputChatBox ('message health and armor chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) setPedArmor ( thePlayer, 100 ) end end addCommandHandler ( "giveall", HealthArmor ) Link to comment
PaulDK Posted May 26, 2014 Author Share Posted May 26, 2014 or try thisServer.lua function buyhealth ( thePlayer ) outputChatBox ('message health chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) end end addCommandHandler ( "health", buyhealth ) --======================= function buyarmor ( thePlayer ) outputChatBox ('message armor chatbox', root, 255, 255, 255, true) setPedArmor ( thePlayer, 100 ) end end addCommandHandler ( "armor", buyarmor ) --====================== function HealthArmor ( thePlayer ) outputChatBox ('message health and armor chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) setPedArmor ( thePlayer, 100 ) end end addCommandHandler ( "giveall", HealthArmor ) Dude we have a TargetPlayer this is not for me and you can use it if you have an admin rights or console . and the outputChatBox("[ the Admin Name or who gaves the health or armor] then what he gaves health or armor ") Link to comment
#RooTs Posted May 26, 2014 Share Posted May 26, 2014 want the command only for admin? you can use isObjectInACLGroup aclGetGroup Link to comment
#RooTs Posted May 26, 2014 Share Posted May 26, 2014 try this function buyhealth ( thePlayer ) local NomeAcl = getAccountName(getPlayerAccount(player)) if ( team and getTeamName(team) == "Admin" ) or isObjectInACLGroup ("user."..NomeAcl, aclGetGroup ( "Admin" ) ) then return end outputChatBox ('message health chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) end end addCommandHandler ( "health", buyhealth ) Link to comment
PaulDK Posted May 26, 2014 Author Share Posted May 26, 2014 try this function buyhealth ( thePlayer ) local NomeAcl = getAccountName(getPlayerAccount(player)) if ( team and getTeamName(team) == "Admin" ) or isObjectInACLGroup ("user."..NomeAcl, aclGetGroup ( "Admin" ) ) then return end outputChatBox ('message health chatbox', root, 255, 255, 255, true) setElementHealth ( thePlayer, 100 ) end end addCommandHandler ( "health", buyhealth ) NO DUDE i WANT I HAVE TARGETPLAYER ... like this /health [playername or id] /armor [playername or id] /armorhealth [playername or id] ok ? Link to comment
TAPL Posted May 26, 2014 Share Posted May 26, 2014 https://forum.multitheftauto.com/viewtopic.php?f=91&t=67767 Link to comment
Chronic Posted May 26, 2014 Share Posted May 26, 2014 function giveHealth ( p1, _, p2 ) if p2 then local ej = getPlayerFromName ( p2 ) if ej then local nab = getPlayerName ( p1 ) setElementHealth ( ej, 100 ) outputChatBox ( nab.." has given you 100% health.", ej ) end end end addCommandHandler ( "givehealth", giveHealth ) 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