Raised This Month: $32 Target: $400
 8% 

Solved [nmrih]Exception reported: Client index 0 is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 05-28-2021 , 12:04   [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #1

This is an old plugin
Can continue to use
Can anyone help me fix it
PHP Code:
L 05/29/2021 00:00:00SourceMod error session started
L 05
/29/2021 00:00:00Info (map "nmo_biohazard_v3_fix") (file "E:\nmrih1\nmrih\addons\sourcemod\logs\errors_20210529.log")
L 05/29/2021 00:00:00: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:00: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:00: [SMCall stack trace:
L 05/29/2021 00:00:00: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:00: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:00: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:00: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:00: [SMCall stack trace:
L 05/29/2021 00:00:00: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:00: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:01: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:01: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:01: [SMCall stack trace:
L 05/29/2021 00:00:01: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:01: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:01: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:01: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:01: [SMCall stack trace:
L 05/29/2021 00:00:01: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:01: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:02: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:02: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:02: [SMCall stack trace:
L 05/29/2021 00:00:02: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:02: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:02: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:02: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:02: [SMCall stack trace:
L 05/29/2021 00:00:02: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:02: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:03: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:03: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:03: [SMCall stack trace:
L 05/29/2021 00:00:03: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:03: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer
L 05
/29/2021 00:00:03: [SMException reportedClient index 0 is invalid
L 05
/29/2021 00:00:03: [SMBlamingadminregen_sm_1.8
L 05
/29/2021 00:00:03: [SMCall stack trace:
L 05/29/2021 00:00:03: [SM]   [0GetClientHealth
L 05
/29/2021 00:00:03: [SM]   [1Line 67, /home/groups/sourcemod/upload_tmp/phphg4rM6.sp::RegenTimer 
Attached Files
File Type: sp Get Plugin or Get Source (adminregen_sm_1.8.sp - 86 views - 2.6 KB)
__________________
I like this BBS sharing of spirit

I come from China, my English is poor

Last edited by phoenix0001; 05-29-2021 at 12:59.
phoenix0001 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-28-2021 , 13:06   Re: [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #2

You just need check if client index == 0 before GetClientHealth
__________________
Marttt is offline
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 05-28-2021 , 13:23   Re: [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
You just need check if client index == 0 before GetClientHealth
I don’t know how to modify the plug-in. Can you modify it for me?
__________________
I like this BBS sharing of spirit

I come from China, my English is poor
phoenix0001 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-28-2021 , 13:49   Re: [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #4

Ok, try this one attached.
Attached Files
File Type: sp Get Plugin or Get Source (adminregen_sm_1.8.sp - 90 views - 2.7 KB)
__________________
Marttt is offline
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 05-28-2021 , 14:23   Re: [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #5

Quote:
Originally Posted by Marttt View Post
Ok, try this one attached.
Wow! thank you! There is no wrong LOGO anymore
__________________
I like this BBS sharing of spirit

I come from China, my English is poor
phoenix0001 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 06-07-2021 , 12:03   Re: [nmrih]Exception reported: Client index 0 is invalid
Reply With Quote #6

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#define PL_VER "1.2.0 (rewritten by Grey83)"

Handle
    hTimer
[MAXPLAYERS+1];
int
    iMax
,
    
iAdd;
float
    fCD
;

public 
Plugin myinfo =
{
    
name        "Admin Regenerate",
    
version        PL_VER,
    
description    "Lets admins regenerate their health with a command",
    
author        "joac1144/Zyanthius"
}

public 
void OnPluginStart()
{
    
CreateConVar("adminregen_version"PL_VER"Plugin version. Do not change."FCVAR_DONTRECORD|FCVAR_NOTIFY|FCVAR_SPONLY);

    
ConVar cvar;
    
cvar CreateConVar("adminregen_maxhp""100""Maximum health you can have by regenerating (0 - plugin disabled)"_true);
    
cvar.AddChangeHook(CVarChange_Max);
    
iMax cvar.IntValue;

    
cvar CreateConVar("adminregen_health""2""Amount of health to regenerate"_true1.0);
    
cvar.AddChangeHook(CVarChange_Add);
    
iAdd cvar.IntValue;

    
cvar CreateConVar("adminregen_time""2.0""Amount of time (in seconds) between each health"_true0.1);
    
cvar.AddChangeHook(CVarChange_CD);
    
fCD cvar.FloatValue;

    
AutoExecConfig(true"plugin.adminregen");

    
RegAdminCmd("sm_adminregen"Cmd_RegenADMFLAG_SLAY"Activates regeneration.");
}

public 
void CVarChange_Max(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    
iMax cvar.IntValue;
}

public 
void CVarChange_Add(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    
iAdd cvar.IntValue;
}

public 
void CVarChange_CD(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    
fCD cvar.FloatValue;
}

public 
void OnMapEnd()
{
    for(
int i 1<= MaxClientsi++) OnClientDisconnect(i);
}

public 
void OnClientDisconnect(int client)
{
    if(
hTimer[client]) delete hTimer;
}

public 
Action Cmd_Regen(int clientint args)
{
    if(!
client || IsFakeClient(client) || GetClientTeam(client) < || !IsPlayerAlive(client))
        return 
Plugin_Handled;

    if(
hTimer[client])
    {
        
ReplyToCommand(client"[SM] You have deactivated regeneration!");
        
PrintToServer("[SM] %N has deactivated regeneration!"client);
        
delete hTimer[client];
        return 
Plugin_Handled;
    }

    if(
GetClientHealth(client) >= iMax)
    {
        
ReplyToCommand(client"[SM] You already have maximum hp!");
        
PrintToServer("[SM] %N already has maximum hp!"client);
        return 
Plugin_Handled;
    }

    
hTimer[client] = CreateTimer(fCDRegenTimerGetClientUserId(client), TIMER_REPEAT);
    
ReplyToCommand(client"[SM] You have activated regeneration!");
    
PrintToServer("[SM] %N has activated regeneration!"client);

    return 
Plugin_Handled;
}

public 
Action RegenTimer(Handle timerint uid)
{
    
int client GetClientOfUserId(uid);
    if(!
client || GetClientTeam(client) < || !IsPlayerAlive(client))
        return 
StopTimer(client);

    
int hp GetClientHealth(client);
    if(
hp >= iMax)
        return 
StopTimer(client);

    if((
hp += iAdd) >= iMax)
    {
        
SetEntityHealth(clientiMax);
        return 
StopTimer(client);
    }

    
SetEntityHealth(clienthp);
    return 
Plugin_Continue;
}

stock Action StopTimer(int client)
{
    
hTimer[client] = null;
    return 
Plugin_Stop;

__________________
Grey83 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 02:18.


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