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

Client index 0 is invalid?


Post New Thread Reply   
 
Thread Tools Display Modes
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-10-2014 , 23:24   Re: Client index 0 is invalid?
Reply With Quote #31

Quote:
Originally Posted by redsword View Post
<

-->

<=
^
|
|
|

Last edited by Mathias.; 01-10-2014 at 23:25.
Mathias. is offline
gilmon
Senior Member
Join Date: Feb 2011
Location: China
Old 01-11-2014 , 00:57   Re: Client index 0 is invalid?
Reply With Quote #32

Quote:
Originally Posted by yokomo View Post
What do you mean by plugin reload? i don't even hook any round_* event. I just hook TakeDamage when player join server.

Well try to change into:
PHP Code:
//public OnClientPostAdminCheck(id)
public OnClientPutInServer(id)
{
    
SDKHook(idSDKHook_OnTakeDamageOnTakeDamage)

Thanks,this really work, no more problem now
gilmon is offline
Send a message via MSN to gilmon
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 01-11-2014 , 07:17   Re: Client index 0 is invalid?
Reply With Quote #33

Quote:
Originally Posted by Black-Rabbit View Post
PHP Code:
public OnPluginStart()
{
    for (new 
=1MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
             
OnClientPutInServer(i);
        }
    }

I would not do that. You might want to do something which is unavailable OnPluginStart yet. Lateload is there for a reason.
xf117 is offline
Send a message via ICQ to xf117
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 01-11-2014 , 09:39   Re: Client index 0 is invalid?
Reply With Quote #34

PHP Code:
new bool:g_bLateLoad;

public 
APLRes:AskPluginLoad2(Handle:myselfbool:lateString:error[], err_max)
{
    
g_bLateLoad late;

    return 
APLRes_Success;
}

public 
OnPluginStart()
{
    if (
g_bLateLoad)
    {
        for (new 
1<= MaxClientsi++)
        {
            
SDKHook(iSDKHook_OnTakeDamageOnTakeDamage);
        }
    }

xf117 is right, AskPluginLoad2 allows you to check whether or not the plugin was loaded late. I am not sure if you would get any errors with what was already posted, but this is the proper way to do this.
Marcus_Brown001 is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-11-2014 , 14:33   Re: Client index 0 is invalid?
Reply With Quote #35

What would it change if the plugin is loaded late or not?
Mathias. is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-11-2014 , 15:01   Re: Client index 0 is invalid?
Reply With Quote #36

Quote:
Originally Posted by Black-Rabbit View Post
What would it change if the plugin is loaded late or not?
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 01-11-2014 , 16:08   Re: Client index 0 is invalid?
Reply With Quote #37

If the plugin does something client-specific when a client joins, then it would be wise to account for whether or not the plugin gets loaded late. When you load a plugin manually, the players already in a server are not accounted for. So, if you hook OnTakeDamage for a client when he joins, if you load the plugin late, any player inside the server when the plugin is loaded will not have that hook.
Marcus_Brown001 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-11-2014 , 16:17   Re: Client index 0 is invalid?
Reply With Quote #38

I know that fact, but the snippet above actually work with or without late load check since OnPluginStart() is executed every time. So any client that are already in game will get hooked. m i wrong?

_________________
GsiX is learning here
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 01-11-2014 at 16:17.
GsiX is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-11-2014 , 20:34   Re: Client index 0 is invalid?
Reply With Quote #39

They will have the hook, OnPluginStart is called when the plugin is loaded, late or not, if it late loaded it dosnt change anything for this case, this is only useful for forwards and or natives that you provide to the other plugins (in most case).
Mathias. 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 13:20.


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