Raised This Month: $12 Target: $400
 3% 

Solved How force health to 100


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-04-2018 , 17:00   How force health to 100
Reply With Quote #1

Hello some map (hide and seek) has 9999 hp for terrorist team

how i can fix it to 100 hp ?

I test with many plugins but not working.

Last edited by vegeta1241; 10-05-2018 at 13:03.
vegeta1241 is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 10-04-2018 , 17:44   Re: How force health to 100
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if (
client != && IsClientInGame(client))
    {
        
SetEntityHealth(client100);
    }

iskenderkebab33 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-04-2018 , 19:32   Re: How force health to 100
Reply With Quote #3

Thanks ! Can you add Also hp 999 for ct please?

Last edited by vegeta1241; 10-04-2018 at 19:33.
vegeta1241 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 10-05-2018 , 02:38   Re: How force health to 100
Reply With Quote #4

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if (
IsClientInGame(client) && IsPlayerAlive(client))
    {
        if (
GetClientTeam(client) == 2)
            
SetEntityHealth(client100);
        else
            
SetEntityHealth(client999);
    }

__________________
8guawong is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 10-05-2018 , 09:04   Re: How force health to 100
Reply With Quote #5

Quote:
Originally Posted by 8guawong View Post
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if (
IsClientInGame(client) && IsPlayerAlive(client))
    {
        if (
GetClientTeam(client) == 2)
            
SetEntityHealth(client100);
        else
            
SetEntityHealth(client999);
    }

I could be wrong, but I think you would need to perform the operation on the next frame since player_spawn is called before the player has actually fully spawned.
ThatKidWhoGames is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-05-2018 , 10:56   Re: How force health to 100
Reply With Quote #6

Maybe with a tiimer?
vegeta1241 is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 10-05-2018 , 11:13   Re: How force health to 100
Reply With Quote #7

Quote:
Originally Posted by vegeta1241 View Post
Maybe with a tiimer?
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
RequestFrame(Frame_Callbackevent.GetInt("userid"));
}

public 
void Frame_Callback(int userid)
{
    
int client GetClientOfUserId(userid);
    if (
client && IsClientInGame(client) && IsPlayerAlive(client))
    {
        if (
GetClientTeam(client) == 2
            
SetEntityHealth(client100); 
        else 
            
SetEntityHealth(client999); 
    }

I would first test the other code though to see if it works. It it doesn't, try this code.

Last edited by ThatKidWhoGames; 10-05-2018 at 11:14.
ThatKidWhoGames is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 10-05-2018 , 11:13   Re: How force health to 100
Reply With Quote #8

Quote:
Originally Posted by vegeta1241 View Post
Maybe with a tiimer?
did you at least try it...?
__________________
8guawong is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-05-2018 , 11:15   Re: How force health to 100
Reply With Quote #9

I Will test it this night, thank you for your script
vegeta1241 is offline
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 10-05-2018 , 12:25   Re: How force health to 100
Reply With Quote #10

Quote:
Originally Posted by ThatKidWhoGames View Post
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
RequestFrame(Frame_Callbackevent.GetInt("userid"));
}

public 
void Frame_Callback(int userid)
{
    
int client GetClientOfUserId(userid);
    if (
client && IsClientInGame(client) && IsPlayerAlive(client))
    {
        if (
GetClientTeam(client) == 2
            
SetEntityHealth(client100); 
        else 
            
SetEntityHealth(client999); 
    }

I would first test the other code though to see if it works. It it doesn't, try this code.
Not working, the health point in terrorist is 9999 (hp of map config)

maybe with a timer when player spawn i think thats the solution
vegeta1241 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:52.


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