Jump to content

Blood And Gas Script


Recommended Posts

Well There Are No Errors But It Doesnt Work

client:

  
local localPlayer = getLocalPlayer() 
local gas = getElementData(localPlayer, "gasmask") 
  
function cancelTearGasChoking(weaponID, localPlayer) 
    if (weaponID==17) and (gas==1) then 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) 

client:

-- Copyright of Fort Carson Roleplay © 
-- Script By haws1290 
  
  
local playerHealth = getElementHealth ( getLocalPlayer() ) 
local localPlayer = getLocalPlayer()  
  
function BloodonDamage( attacker, weapon, bodypart ) 
   if ( getElementHealth(localPlayer) < 20 ) then 
      local x, y, z = getElementPosition( localPlayer )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

Link to comment
Well There Are No Errors But It Doesnt Work

client:

  
local localPlayer = getLocalPlayer() 
local gas = getElementData(localPlayer, "gasmask") 
  
function cancelTearGasChoking(weaponID, localPlayer) 
    if (weaponID==17) and (gas==1) then 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) 

client:

-- Copyright of Fort Carson Roleplay © 
-- Script By haws1290 
  
  
local playerHealth = getElementHealth ( getLocalPlayer() ) 
local localPlayer = getLocalPlayer()  
  
function BloodonDamage( attacker, weapon, bodypart ) 
   if ( getElementHealth(localPlayer) < 20 ) then 
      local x, y, z = getElementPosition( localPlayer )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

anyone??????

Link to comment

-- Gas mask:

function cancelTearGasChoking ( weaponID ) 
    local gas = getElementData ( localPlayer, "gasmask" ) -- You have to get it inside the function. 
    if ( weaponID == 17 ) and ( gas == 1 ) then 
        cancelEvent ( ) 
    end 
end 
addEventHandler ( "onClientPlayerChoke", localPlayer, cancelTearGasChoking ) 

About blood, I don't know what's wrong with it.

Link to comment
Of course, is a client side script.

Fixed It But Now I Got Another Problem, It Doesnt setElementData to 0 for the mask and gas mask

elseif (itemID==26) then -- GASMASK 
            local gas = getElementData(source, "gasmask") 
             
            if not (gas) or (gas==0) then 
                exports.global:sendLocalMeAction(source, "slips a black gas mask over their face.") 
                 
                -- can't see their name 
                local pid = getElementData(source, "playerid") 
                local fixedName = "Unknown Person(Gas M)" 
                setPlayerNametagText(source, tostring(fixedName)) 
                setElementData(source, "gasmask", 1) 
  
                exports['anticheat-system']:changeProtectedElementDataEx(source, "gasmask", 1, false) 
            elseif (gas==1) then 
                exports.global:sendLocalMeAction(source, "slips a black gas mask off their face.") 
                 
                -- can't see their name 
                local pid = getElementData(source, "playerid") 
                local name = string.gsub(getPlayerName(source), "_", " ") 
                setPlayerNametagText(source, tostring(name)) 
                setElementData(source, "gasmask", 0) 
  
                exports['anticheat-system']:changeProtectedElementDataEx(source, "gasmask", 0, false) 
            end 

elseif (itemID==56) then -- MASK 
            local mask = getElementData(source, "mask") 
             
            if not (mask) or (mask==0) then 
                exports.global:sendLocalMeAction(source, "slips a mask over their face.") 
                 
                -- can't see their name 
                local pid = getElementData(source, "playerid") 
                local fixedName = "Unknown Person(Mask)" 
                setPlayerNametagText(source, tostring(fixedName)) 
                setElementData(source, "mask", 1) 
  
                exports['anticheat-system']:changeProtectedElementDataEx(source, "mask", 1, false) 
            elseif (mask==1) then 
                exports.global:sendLocalMeAction(source, "slips a mask off their face.") 
                 
                -- can't see their name 
                local pid = getElementData(source, "playerid") 
                local name = string.gsub(getPlayerName(source), "_", " ") 
                setPlayerNametagText(source, tostring(name)) 
                setElementData(source, "mask", 0) 
  
                exports['anticheat-system']:changeProtectedElementDataEx(source, "mask", 0, false) 
            end 

Link to comment
Well There Are No Errors But It Doesnt Work

client:

  
local localPlayer = getLocalPlayer() 
local gas = getElementData(localPlayer, "gasmask") 
  
function cancelTearGasChoking(weaponID, localPlayer) 
    if (weaponID==17) and (gas==1) then 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) 

client:

-- Copyright of Fort Carson Roleplay © 
-- Script By haws1290 
  
  
local playerHealth = getElementHealth ( getLocalPlayer() ) 
local localPlayer = getLocalPlayer()  
  
function BloodonDamage( attacker, weapon, bodypart ) 
   if ( getElementHealth(localPlayer) < 20 ) then 
      local x, y, z = getElementPosition( localPlayer )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

  
  
function BloodonDamage() 
   if ( getElementHealth(source) < 20 ) then 
      local x,y,z = getElementPosition( source )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

Link to comment
Well There Are No Errors But It Doesnt Work

client:

  
local localPlayer = getLocalPlayer() 
local gas = getElementData(localPlayer, "gasmask") 
  
function cancelTearGasChoking(weaponID, localPlayer) 
    if (weaponID==17) and (gas==1) then 
        cancelEvent() 
    end 
end 
addEventHandler("onClientPlayerChoke", localPlayer, cancelTearGasChoking) 

client:

-- Copyright of Fort Carson Roleplay © 
-- Script By haws1290 
  
  
local playerHealth = getElementHealth ( getLocalPlayer() ) 
local localPlayer = getLocalPlayer()  
  
function BloodonDamage( attacker, weapon, bodypart ) 
   if ( getElementHealth(localPlayer) < 20 ) then 
      local x, y, z = getElementPosition( localPlayer )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

  
  
function BloodonDamage() 
   if ( getElementHealth(source) < 20 ) then 
      local x,y,z = getElementPosition( source )  
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, 4, 1 ) 
   end 
end 
addEventHandler ( "onClientPlayerDamage", localPlayer, BloodonDamage ) 

You cant use source in a client side can you?

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