Function question
I am wondering if variables keep their values from one function to another?
I mean if I have like that: << new var; public func1() { var = 2; } public func2() { var = var * 2; return var; } >> the variable returned will be 4 or will it be 0( like it would in other languages like C++ )? 2nd question: how can I detect a player's death? |
Re: Function question
Please use code/php/small tags, it's easy to read.
If you change the variable value in a function, it will keep this value until it's changed again. Code:
For the 2nd question you should search before asking something. You need to register DeathMsg event or to hook Ham_Killed. Also you have a forward in csx for that( client_death ? ). |
Re: Function question
Thanks, I am sorry, I found the answer after I asked the question, my bad.And thank you for your answer.
|
Re: Function question
DeathMsg may be better in most cases, speacking about the time that it needs to register and to execute. Also, in Ham_Killed you can't know directly if it was a headshot or not, you would need to hook trace attack and see if TR_iHitgroup is 1, then set a bool or whatever to true and check it in Ham_Killed.
|
| All times are GMT -4. The time now is 17:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.