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

Solved Client 1 is not in game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thaiguitar
New Member
Join Date: Apr 2021
Old 04-08-2021 , 05:53   Client 1 is not in game
Reply With Quote #1

Hello I want you guys to help
now i use one mod but for a long time in 2008

https://forums.alliedmods.net/showthread.php?p=500636

PHP Code:
#pragma semicolon 1

/*
 *    HP Regeneration
 *    by MaTTe (mateo10)
 */

#define VERSION "1.0"

public Plugin:myinfo =
{
    
name "HP Regeneration",
    
author "MaTTe",
    
description "As the title says, this plugin regenerates your hp to maximum",
    
version VERSION,
    
url "http://www.sourcemod.net/"
};

new 
Handle:g_hRegenTimer[MAXPLAYERS 1];

new 
Handle:g_Interval;
new 
Handle:g_MaxHP;
new 
Handle:g_Inc;

public 
OnPluginStart()
{
    
CreateConVar("hpregeneration_version"VERSION"HP Regeneration Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
g_Interval CreateConVar("hpregen_interval""1.0");
    
g_MaxHP CreateConVar("hpregen_maxhp""100");
    
g_Inc CreateConVar("hpregen_inc""10");

    
HookEvent("player_hurt"HookPlayerHurt);
}

public 
HookPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
iUserId GetEventInt(event"userid");
    new 
client GetClientOfUserId(iUserId);

    if(
g_hRegenTimer[client] == INVALID_HANDLE)
    {
        
g_hRegenTimer[client] = CreateTimer(GetConVarFloat(g_Interval), RegenerateclientTIMER_REPEAT);
    }
}

public 
Action:Regenerate(Handle:timerany:client)
{
    new 
ClientHealth GetClientHealth(client);

    if(
ClientHealth GetConVarInt(g_MaxHP))
    {
        
SetClientHealth(clientClientHealth GetConVarInt(g_Inc));
    }
    else
    {
        
SetClientHealth(clientGetConVarInt(g_MaxHP));
        
g_hRegenTimer[client] = INVALID_HANDLE;
        
KillTimer(timer);
    }
}

SetClientHealth(clientamount)
{
    new 
HealthOffs FindDataMapOffs(client"m_iHealth");
    
SetEntData(clientHealthOffsamounttrue);

The problems i encountered are
in the beginning the mod works normally
but when someone leaves the server the mod will inform that the player has left and cannot find that player



What should i do to fix it?
Thank you very much.
Attached Files
File Type: smx regeneration.smx (2.2 KB, 16 views)
File Type: sp Get Plugin or Get Source (regeneration.sp - 61 views - 1.6 KB)

Last edited by thaiguitar; 04-08-2021 at 08:04.
thaiguitar is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 04-08-2021 , 06:42   Re: Client 1 is not in game
Reply With Quote #2

Just add a check if Player is in game....
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
thaiguitar
New Member
Join Date: Apr 2021
Old 04-08-2021 , 08:03   Re: Client 1 is not in game
Reply With Quote #3

After defining player
look like i can do it
thank you very much.
thaiguitar is offline
Reply



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 09:45.


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