0% found this document useful (0 votes)
19 views2 pages

Enable Friendly Fire Option

The document outlines a Lua script for managing player health, armor, and weapon updates in a game environment. It includes functions to set, get, and modify player health and armor, as well as threads that periodically update player positions and weapon status when the player is ready. The script utilizes Citizen threads to ensure continuous updates while the game is running.

Uploaded by

vulgowhite395
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Enable Friendly Fire Option

The document outlines a Lua script for managing player health, armor, and weapon updates in a game environment. It includes functions to set, get, and modify player health and armor, as well as threads that periodically update player positions and weapon status when the player is ready. The script utilizes Citizen threads to ensure continuous updates while the game is running.

Uploaded by

vulgowhite395
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-----------------------------------------------------------------------------------

------------------------------------------------------
-- VARIABLES
-----------------------------------------------------------------------------------
------------------------------------------------------
local playerReady = false
-----------------------------------------------------------------------------------
------------------------------------------------------
-- PLAYERREADY
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link]()
playerReady = true
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- THREADREADY
-----------------------------------------------------------------------------------
------------------------------------------------------
[Link](function()
NetworkSetFriendlyFireOption(true)
SetCanAttackFriendly(PlayerPedId(),true,true)

while true do
if playerReady then
local coords = GetEntityCoords(PlayerPedId())
vRPserver._updatePositions(coords.x,coords.y,coords.z)
end

[Link](10000)
end
end)
-----------------------------------------------------------------------------------
------------------------------------------------------
-- THREADREADY
-----------------------------------------------------------------------------------
------------------------------------------------------
[Link](function()
while true do
if playerReady then
vRPserver._updateHealth(GetEntityHealth(PlayerPedId()))
vRPserver._updateArmour(GetPedArmour(PlayerPedId()))
end

[Link](30000)
end
end)
-----------------------------------------------------------------------------------
------------------------------------------------------
-- GETHEALTH
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link]()
return GetEntityHealth(PlayerPedId())
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- SETHEALTH
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](health)
SetEntityHealth(PlayerPedId(),parseInt(health))
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- UPDATEHEALTH
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](number)
local ped = PlayerPedId()
local health = GetEntityHealth(ped)
if health > 101 then
SetEntityHealth(ped,parseInt(health+number))
end
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- DOWNHEALTH
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](number)
local ped = PlayerPedId()
local health = GetEntityHealth(ped)

SetEntityHealth(ped,parseInt(health-number))
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- GETARMOUR
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link]()
return GetPedArmour(PlayerPedId())
end
-----------------------------------------------------------------------------------
------------------------------------------------------
-- SETARMOUR
-----------------------------------------------------------------------------------
------------------------------------------------------
function [Link](amount)
local ped = PlayerPedId()
local armour = GetPedArmour(ped)
SetPedArmour(ped,parseInt(armour+amount))
end

[Link](function()
while true do
[Link](1000)
if IsPlayerPlaying(PlayerId()) and playerReady then
vRPserver._updateWeapons([Link]())
end
end
end)

You might also like