Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem changeing maxhealth
#1
I'm trying to change players hp induvidually depending on what team they are on using this code.

PHP Code:
sethp(hp)                                                          
{                                                                  
  
self.maxhealth hp;                                             
  
self.health self.maxhealth;                                    
  
self iPrintLn(self.name+" maxhealth: "+self.maxhealth"hp:"+hp);


It prints the name correctly by different clients so I know it gets run as player but it refuses to change the maxhp. Is there something else that needs to be changed to get it to work?
Reply

#2
Huh? this should work fine ... try this.. maybe it doesn't register fast enough

Code:
sethp(hp)                                                          
{                                                                  
    self.maxhealth = hp;                                            
    self.health = self.maxhealth;      
    wait .05;
    self iPrintLn(self.name+" maxhealth: "+self.maxhealth+ "hp:"+hp);
}
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#3
Im printing out the maxhp somewhere else all the time and tested it by just shooting people/bots, the maxhealth just wont change.

-----EDIT----

Tried calling the function in onPlayerSpawned()... worked fine.
But calling the function in a for level.players loop doesnt.
Strange thing is the function recognizes the player it is called on since it outputs the player.name correctly.
Reply

#4
(07-02-2011, 17:07)iAegle Wrote: Huh? this should work fine ... try this.. maybe it doesn't register fast enough

Code:
sethp(hp)                                                          
{                                                                  
    self.maxhealth = hp;                                            
    self.health = self.maxhealth;      
    wait .05;
    self iPrintLn(self.name+" maxhealth: "+self.maxhealth+ "hp:"+hp);
}

That's not going to matter at all. Maybe you should attempt to loop the iprintln to see if the game sets it back to another value at all.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Android problem Yamato 12 7,498 04-25-2014, 04:49
Last Post: ScHmIdTy56789
  Problem with Rain Effects on Maps mitchhacker 5 4,451 10-22-2013, 00:46
Last Post: mitchhacker
  Help Liberation Problem Yamato 27 23,467 07-17-2013, 19:54
Last Post: feature
  [xna 4]Rendering problem narkos 9 5,316 07-03-2013, 19:00
Last Post: Nekochan
  Help Problem God plugin v4.0 4nonymous 1 2,544 06-22-2013, 23:25
Last Post: 8q4s8
  Help Infected Shop Plugin Problem Hallla 2 2,914 05-06-2013, 18:29
Last Post: Hallla
  problem with gsc code CheGuevara 5 5,106 04-20-2013, 15:06
Last Post: Nekochan
  problem to connect to server s.j-rez 0 2,095 04-17-2013, 18:18
Last Post: s.j-rez
  warning problem AndEEDJay 0 1,960 04-08-2013, 09:54
Last Post: AndEEDJay
  Help ADDON,PROBLEM HACK emilioxativa 5 4,522 04-03-2013, 08:16
Last Post: narkos

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.