Jump to content

[HELP] Armor And Health


PaulDK

Recommended Posts

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. :D

Thanks i hope you will help me ! :D:?:

Link to comment

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

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
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 ) 

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

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...