Can you fix this plugin, so it doesn't kill players at the beginning of the round?
Hello. This plugin is about health regeneration regarding all players on the server. It's about constant health regeneration, until the amount of the player's health reaches the maximum according to the settings of the ZP mod itself:
PHP Code:
When this problem happens after the first round, in the beginning of the second round, everyone is spawned already dead, and has -1 health. This option "g_Amount = register_cvar("zp_regen_amount", "10")" suggests the amount of HP per second is 10. However, it's 1000-2000, because the plugin works ultra-fast, and the 10hp are coming multiple times per second, not only one time per second. This sound: "new const health_sound[] = "zb/zombi_heal.wav"" is never finished. You hear only the first fraction of the first second, after which it repeats only the first fraction of the second, but never finishes the whole sound. This explains that the plugin works ultra-fast, and there is no time for the sound of giving 10hp to be finished, because the next 10hp is given even before the sound finishes. The sound has to be played once per received 10hp. Since you don't receive 10hp per second, but around 1000-2000hp per second, the sound is repeated 1000-2000 times per second. The same goes for the .spr file that comes out of you when you receive 10hp. Instead of your model releasing one sprite per second, it releases thousands of sprites per second. I think this 'ultra-fast' bug is causing the problem. Do you understand what I'm trying to explain? If you have a zombie mod, i recommend you to test the plugin, so you can understand what I'm talking about. If you don't know how to fix the problem, just tell me. I already know how to have regeneration for all zombies, however, i have to add separated codes to each .sma file of each zombie, which means that if i want to disable the regeneration, i will have to edit all zombie classes, instead of just putting ";" before the name of the regeneration plugin i presented in this thread. I prefer to have one plugin controlling the HP of all zombies, instead of having to individually interfere in every single .sma file each time i want to change the regeneration. I know my English is not good. If you don't understand me, just say it, and i will try to explain it in better way. |
Re: Can you fix this plugin, so it doesn't kill players at the beginning of the round
I straight up ignored all the text you wrote because is longer than the code itself and decided to read the entire code instead.
All I can say is that the plugin is terrible. Ignoring all useless checks and poor coding, the main problem lies here: Code:
This piece of code will initiate a repeating function that regenerates the player's health every time he takes damage. So, if someone shoots 30 bullets at you, this wonderful plugin will initiate 30x times the regeneration function that will be called each second => 30 times per second => 30x times the amount of healing set in the cvar. A simple solution would be to just do "remove_task(Client)" before activating the task, but the smart thing to do is using "set_task" just once when the player joins the server and simply check if he's alive and the health is less than needed. Is there a reason to activate the task every time the player takes damage? |
Re: Can you fix this plugin, so it doesn't kill players at the beginning of the round
Quote:
I found a better and simpler alternative. I will just use the health regeneration codes used in the code of the Regeneration zombie, and i will transfer them to the codes of all other zombie classes i have in my ZM server. I no longer need help to fix the problems this plugin causes, because i will use other methods. "Is there a reason to activate the task every time the player takes damage?" No. |
Re: Can you fix this plugin, so it doesn't kill players at the beginning of the round
I created regeneration class for my server, check it:
PHP Code:
|
Re: Can you fix this plugin, so it doesn't kill players at the beginning of the round
Quote:
|
Re: Can you fix this plugin, so it doesn't kill players at the beginning of the round
I gave you an example of creating a regeneration zombie class but if you did copy/paste will get error messages
|
All times are GMT -4. The time now is 07:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.