Jump to content

help max health


Recommended Posts

Posted

You can use

setElementData 

setElementData(source,"health",250) 

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted

So you want the health to be 250?

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted

Give the code

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted

No not this way where you have your code where the player spawns add it there don't make an individual resource

"When i'll grow older, i'll be stronger, they'll call me freedom, just like a waving flag"

"Have confidence in yourself, no problem is impossible in life"

Posted

this my script where i add

local hospitalTable = {} 
local hospitals = { 
    -- mx, my, mz, tarx, tary, tarz, x, y, z, rot, name 
    [1] = {1218, -1322, 15, 1217, -1322, 15, 1173, -1326, 15, 270, "All Saints Hospital"}, -- All Saints 
    [2] = {2033, -1439, 19, 2033, -1438, 18, 2038, -1411, 17, 130, "Jefferson Hospital."}, --Jefferson 
    [3] = {1254, 352, 21, 1254, 351, 21, 1242, 327, 19, 340, "Red County Hospital."}, -- Red County 
    [4] = {1590, 1862, 12, 1590, 1861, 12, 1609, 1816, 12, 360, "Las Venturas Hospital."}, -- Las Venturas 
    [5] = {-2660, 580, 16, -2660, 581, 16, -2655, 635, 14, 180, "San Fierro Hospital."}, -- San Fierro 
    [6] = {-2181, -2289, 32, -2181, -2290, 32, -2200, -2311, 30, 320, "Angel Pine Hospital."}, -- Angel Pine 
        [7] = {4329.82, 748.048, 21.09, 4325.158, 817.8122, 8.10, 4325.158, 817.8122, 8.10, 180, "Sea Hospital."} -- SeaHospital 
} 
  
function viewTheHospital() 
    local table = findHospital(source) 
    local theMessage = "You have died and been taken to "..table[11] 
    setCameraMatrix(source, table[1], table[2], table[3], table[4], table[5], table[6]) 
    showPlayerHudComponent(source, "all", false) 
        setTimer(finsihHospitalIntro, 4000, 1, source, getElementModel(source), table[7], table[8], table[9], table[10]) 
end 
addEventHandler("onPlayerWasted", root, viewTheHospital) 
  
function finsihHospitalIntro(player, model, x, y, z, rotation) 
                local wantedLevel = getPlayerWantedLevel(player) 
                if(wantedLevel > 0) then 
                showPlayerHudComponent(player, "all", true) 
                setCameraTarget(player, player) 
                spawnPlayer(player, x, y, z, rotation, model, 0, 0) 
                local points = tonumber(getElementData(player, "CORpolice.wantedPoints")) or 0 
                exports.CORprison:sendPlayerToPrison(player, points * 1000) 
          return 
    end 
            if (isElement(player)) then 
        fadeCamera(player, false, 0) 
        setTimer(fadeCamera, 500, 1, player, true) 
        setCameraTarget(player, player) 
        showPlayerHudComponent(player, "all", true) 
        spawnPlayer(player, x, y, z, rotation, model, 0, 0) 
        hospitalTable[player] = nil 
    end 
end 
  
function findHospital(plr) 
    if (isElement(plr)) then 
        local theHospital = nil 
        local miniumDistance = 2000 
        for index, pos in pairs(hospitals) do 
            local px, py, pz = getElementPosition(plr) 
            local x, y = pos[7], pos[8] 
            local distance = getDistanceBetweenPoints2D(px, py, x, y) 
            if (distance < miniumDistance) then 
                theHospital = pos 
                miniumDistance = distance 
            end 
        end 
        hospitalTable[plr] = theHospital 
        return hospitalTable[plr] 
    end 
end 

Posted
pls can u add it for me cuz i did not get it

You don't need to use setElementData

Example

  
addEventHandler ( "onPlayerSpawn",root, 
function() 
    setPedStat ( source, 24, 1000 ) 
    setElementHealth ( source, 200 ) 
end  
) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
pls can u add it for me cuz i did not get it

You don't need to use setElementData

Example

  
addEventHandler ( "onPlayerSpawn",root, 
function() 
    setPedStat ( source, 24, 1000 ) 
    setElementHealth ( source, 200 ) 
end  
) 

/

where do i put this script

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