Jump to content

question


Recommended Posts

Solidsnake14 vs Evil-Cod3r we Play in my server you have hit me with m-4 -50 of my health

i set my health +50 form the admin panel

i want output a msg called ("evil-Cod3r.. Has Set His Health 50 He Cheat on the Map !!!")

did you get it now?

i wnat you to see the msg if i give my self health or not becuse some players cheat on there server !

i want script Anti-Health Cheat !

Link to comment

Ok, now I understand.

-- client side:

local oldHealth = getElementHealth(localPlayer) 
  
function checkPlayerHealth() 
    local currentHealth = getElementHealth(localPlayer) 
    if (currentHealth ~= oldHealth) then 
        if (oldHealth < currentHealth) then 
            triggerServerEvent("onPlayerHealthChanged",localPlayer,oldHealth,currentHealth) 
        end 
        oldHealth = currentHealth 
    end 
end 
addEventHandler("onClientPreRender",root,checkPlayerHealth) 

-- server side:

addEvent("onPlayerHealthChanged",true) 
addEventHandler("onPlayerHealthChanged",root, 
    function (old, new) 
        outputChatBox(getPlayerName(source) .." has set his health from ".. old .." to ".. new .." he cheated on the map!",root,255,0,0) 
    end 
) 

Link to comment

yes yes yes yes yes thank god Man !

you have made it but what if the admin give another player health dos it show on the chat ??

local name = getPlayerName(admin) 
local him = getPlayerName(source) 
local value = getElementHealth() 
function show () 
if (admin give player health and the Player got the health ) then 
outputChatBox(name.. "Has Give .. him .. value .. of Health") 
end 
addEventHandler ( "onResourceStart", getRootElement(), show) 

Link to comment

last thing this what i mean

---serverSide

addEvent("onPlayerHealthChanged",true) 
addEventHandler("onPlayerHealthChanged",root, 
    function (old, new) 
        outputChatBox(getPlayerName(source) .. "Has Set(getPlayerName(source) health from ".. old .." to ".. new ..",root,255,0,0) 
    end 
) 
 

---clientSide

local oldHealth = getElementHealth(localPlayer) 
  
function checkPlayerHealth() 
    local currentHealth = getElementHealth(localPlayer) 
    if (currentHealth ~= oldHealth) then 
        if (oldHealth < currentHealth) then 
            triggerServerEvent("onPlayerHealthChanged",localPlayer,oldHealth,currentHealth) 
        end 
        oldHealth = currentHealth 
    end 
end 
addEventHandler("onClientPreRender",root,checkPlayerHealth) 

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