myonlake Posted March 2, 2012 Share Posted March 2, 2012 How do you give health? - command - GUI - marker/object/other events Almost everytime I've replied, I have told you how to make the one simple chatbox message, please, read! Link to comment
Evil-Cod3r Posted March 2, 2012 Author Share Posted March 2, 2012 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
Castillo Posted March 2, 2012 Share Posted March 2, 2012 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
Evil-Cod3r Posted March 2, 2012 Author Share Posted March 2, 2012 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
Castillo Posted March 2, 2012 Share Posted March 2, 2012 Copy my script again, I've fixed a bug. And about your question, no, you can't know who changed the player health. Link to comment
Evil-Cod3r Posted March 2, 2012 Author Share Posted March 2, 2012 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
Castillo Posted March 2, 2012 Share Posted March 2, 2012 As I told you, you can't know who set the health of the player. Link to comment
Evil-Cod3r Posted March 2, 2012 Author Share Posted March 2, 2012 Ok Thanx all for helpin me iam sorry to make you tired with me sorry Close :Topic: Link to comment
Scooby Posted March 2, 2012 Share Posted March 2, 2012 just find the function in the resource u have that sets the health of the player and add it there. (admin panel? admin_server.lua - halfway down the script - add the line there) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now