Raised This Month: $12 Target: $400
 3% 

how to set player health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naleksuh
Member
Join Date: Dec 2018
Old 02-25-2019 , 00:05   how to set player health
Reply With Quote #1

hello, i'm try to find way to set player health without problems. Previous i was using
PHP Code:
SetEntityHealth(clientnumber); 
but this has problems that it say it's not valid entity, even if client i give it is right. Is there better approach to this? it's the only thing i've been able to find in searches
Naleksuh is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 02-25-2019 , 00:27   Re: how to set player health
Reply With Quote #2

Quote:
Originally Posted by Naleksuh View Post
hello, i'm try to find way to set player health without problems. Previous i was using
PHP Code:
SetEntityHealth(clientnumber); 
but this has problems that it say it's not valid entity, even if client i give it is right. Is there better approach to this? it's the only thing i've been able to find in searches
You probably just need to check if the client is a valid index, is in-game, and is alive.

PHP Code:
if (client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
{
    
SetEntityHealth(clientnumber);

__________________
Psyk0tik is offline
Naleksuh
Member
Join Date: Dec 2018
Old 02-25-2019 , 00:40   Re: how to set player health
Reply With Quote #3

alright i'll try it but what happens if that returns "false" then player don't have health set
Naleksuh is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 02-25-2019 , 13:06   Re: how to set player health
Reply With Quote #4

Then
1)client index is invalid
Or
2)Not in game
Or
3)Not alive

And this code dont have return

Last edited by Indarello; 02-25-2019 at 13:07.
Indarello is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-25-2019 , 16:33   Re: how to set player health
Reply With Quote #5

Naleksuh, what moment or event do you use to set health in?
Show complete code.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Naleksuh
Member
Join Date: Dec 2018
Old 02-28-2019 , 01:13   Re: how to set player health
Reply With Quote #6

Quote:
Originally Posted by Naleksuh View Post
alright i'll try it but what happens if that returns "false" then player don't have health set
problem fixed. thank you, crasher.
Naleksuh is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode