AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_health (https://forums.alliedmods.net/showthread.php?t=220922)

cstrike37 07-15-2013 23:38

set_user_health
 
sometimes it gives 500 health or more instead of 250 if the user spawn too fast.. How do i fix this?
PHP Code:

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <hamsandwich> 

#define PLUGIN "Bonus Health" 
#define VERSION "1.0" 
#define AUTHOR "cstrike37" 


public plugin_init() { 
   
    
register_plugin(PLUGINVERSIONAUTHOR
    
RegisterHam(Ham_Spawn"player""Spawn"1)
    

public 
Spawn(id

    new 
model[32]
    
cs_get_user_model(idmodelcharsmax(model))
    if (
equal(model"gign"))
    
set_task(1.0"setbonushp"id)
}
public 
setbonushp(id)
{
    
remove_task(0)
    
set_user_health(idget_user_health(id) + 250)




Bos93 07-15-2013 23:55

Re: set_user_health
 
Your plugin correct.

Quote:

if the user spawn too fast..

Maybe other plugins give health?

wickedd 07-16-2013 00:09

Re: set_user_health
 
Check if is_user_alive, also you don't need a task.

cstrike37 07-16-2013 03:14

Re: set_user_health
 
Quote:

Originally Posted by Bos93 (Post 1991826)
Your plugin correct.

Maybe other plugins give health?

I disabled all the plugins that gives health. still not working..
Quote:

Originally Posted by wickedd (Post 1991830)
Check if is_user_alive, also you don't need a task.

Tried, no luck =/

I got instant respawn on my server..

Bos93 07-16-2013 03:30

Re: set_user_health
 
Quote:

if the user spawn too fast..
Quote:

I got instant respawn on my server..
What is this?

your mode ZP?


The problem is not with this plugin


maybe:

-> Spawn player - set 100 hp (default)

-> 1 sec... + 250 hp

-> = 350 hp,But you are using an old build and you do not show the correct messages health

Xalus 07-16-2013 06:18

Re: set_user_health
 
Probaly because players spawns twice in less then 1 second.

PHP Code:

#include <amxmodx>  
#include <amxmisc>  
#include <cstrike>  
#include <fun>  
#include <hamsandwich>  

#define PLUGIN "Bonus Health"  
#define VERSION "1.0"  
#define AUTHOR "cstrike37"  

public plugin_init() {  
    
    
register_plugin(PLUGINVERSIONAUTHOR)  
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn"1
     
}  
public 
Ham_PlayerSpawn(id)  
{  
    if(
is_user_alive(id))
    {
        static 
model[32
        
cs_get_user_model(idmodelcharsmax(model)) 
        
        if (
equal(model"gign")) 
             
set_user_health(idget_user_health(id) + 250
    }




All times are GMT -4. The time now is 06:28.

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