Change the damage weapon without recover Health/Armor?
#3

Humm no, i know.

My script its...

PHP код:
switch(weaponid)
                    {
                        case 
15amount 12;
                        case 
5amount 12;
                           case 
22amount 18;
                        case 
28amount 8;
                        case 
29amount 10;
                        case 
32amount 9;
                        case 
33amount 40;
                        case 
34amount 50;
                    }
                       
armour armour amount;
                    if(
armour 0.0)
                    {
                          
health += armour;
                         if(
health <= 0.0)
                         {
                            
health 0.0;
                           }
                        
armour 0.0;
                     }
                     
SetPlayerHealth(playeridhealth);
                     
SetPlayerArmour(playeridarmour); 
My problem its when a player has a weapon rapid(MP5,AK, other...) the script doesnt have the time for check the Heal/Armor and recover sometimes the heal or armor, MP2 as explained.

Quote:
Originally Posted by MP2
Посмотреть сообщение
Introduction

You may be thinking 'why not just save their old armour AND health, then use GetPlayerHealth + GetPlayerArmour under OnPlayerGive/Take damage to see what was lost? Well. GetPlayerHealth/Armour doesn't work under OnPlayerGive/TakeDamage because they don't sync with the server until the next OnPlayerUpdate call, which would involve pretty much the same amount of code as this did, but you'd have to have a variable to store their health also. Why waste memory?!
Quote:
Originally Posted by MP2
Посмотреть сообщение
I just did some basic testing and it turns out my theory was (unfortunately) correct. OnPlayerUpdate isn't called between every call of OnPlayerGive/TakeDamage. I'm still not sure if the health/armour are synced separately to OPU though, more testing is needed. It should be okay for any damage apart from fire (which removes health faster than OPU!).

I don't really want to hook OPU though, so I may just store players' health in two arrays and deduct the health/armour loss manually instead of relying on the syncing. But then again, some factors (which I can't think of right at this moment) may interfere such as vending machines.

I will leave this how it is for now, as it only affects (I think) fire.
Someone found a solution?
Reply


Messages In This Thread
Change the damage weapon without bug? - by HitnKill - 18.02.2013, 11:33
Re: Change the damage weapon without recover Health/Armor? - by iManakoss - 18.02.2013, 13:22
Re: Change the damage weapon without recover Health/Armor? - by HitnKill - 18.02.2013, 15:08

Forum Jump:


Users browsing this thread: 2 Guest(s)