Jump to content

giveHealth problem


Recommended Posts

Posted

Well I'm trying to create a script that when I write / givehealth, make him give life to those who are in my area .. eg first I tried to create with getZoneName, most did not work someone help me?

Script:

function giveHealth(source) 
    accountname = getAccountName (getPlayerAccount(source)) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        for i,player in ipairs(getElementsByType("player")) do 
            setElementHealth(player, 200) 
        end 
        setTimer(outputChatBox,50,1,"#00FFFF[#00FFFFSERVER#00FFFF] #00FFFF"..getPlayerName (source) .. " #00FFFFDeu Vida Para todos os Jogadores",getRootElement(),171,205,239,true) 
    else 
        outputChatBox("#ABCDEF* Você não é um Administrador.",source,171,205,239,true) 
    end 
end 
addCommandHandler("darvida",giveHealth) 

I'm trying to use, it would be right?

GetZoneName 

Posted

to do players life 200

their Health stat must be 1000

so Try this:

function giveHealth(source) 
    local accountname = getAccountName (getPlayerAccount(source)) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        for i,player in ipairs(getElementsByType("player")) do 
            setPlayerStat ( player, 24, 1000 ) 
            setElementHealth(player, 200) 
        end 
        setTimer(outputChatBox,50,1,"#00FFFF[#00FFFFSERVER#00FFFF] #00FFFF"..getPlayerName (source) .. " #00FFFFDeu Vida Para todos os Jogadores",getRootElement(),171,205,239,true) 
    else 
        outputChatBox("#ABCDEF* Você não é um Administrador.",source,171,205,239,true) 
    end 
end 
addCommandHandler("darvida",giveHealth) 

I'm trying to use, it would be right?

GetZoneName 

it would be right or no by how you will make it

Posted

To get all players around you, you can calculate their distance with:

getDistanceBetweenPoints3D 

or:

getDistanceBetweenPoints2D 

Or you can also use colshapes:

createColTube 
getElementsWithinColShape 

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