anakin_cstrike
01-02-2012, 12:56
So i have this for instance
#include <sourcemod>
new gi_MaxPlayers;
public OnPluginStart()
{
gi_MaxPlayers = GetMaxClients ( );
}
public Action:MyFunc ( /* ... */ )
{
MyStock ( );
return;
}
stock MyStock ( /* ... */ )
{
for ( new i_Index = 1; i_Index <= gi_MaxPlayers; i_Index++ )
{
if ( ! IsClientInGame ( i_Index ) || ! IsPlayerAlive ( i_Index ) )
continue;
PrintToChat ( i_Index,"test" );
}
}
I'm the only one connected to the server and it doesn't prints me that message, nor i receive some error in the server console. What's the problem? thanks
EDIT: ok so i kinda fixed it, i think the problem was that i have maxclients set to 16, i just put 32 or random number instead of the index and it works...but why?
EDIT2: Now i'm getting this error and it bothers me for a while
L 01/02/2012 - 20:09:02: [SM] Native "IsClientInGame" reported: Client index 17 is invalid
L 01/02/2012 - 20:09:02: [SM] Displaying call stack trace for plugin "who.smx":
L 01/02/2012 - 20:09:02: [SM] [0] Line 79, C:\sourcemod\scripting\who.sp::HookBulletImpa ct()
the code is like this
for ( new i_Player = 1; i_Player <= 32; i_Player++ )
{
if ( ! ( IsClientInGame ( i_Player ) && ! IsPlayerAlive ( i_Player ) ) )
continue;
// stuff...
#include <sourcemod>
new gi_MaxPlayers;
public OnPluginStart()
{
gi_MaxPlayers = GetMaxClients ( );
}
public Action:MyFunc ( /* ... */ )
{
MyStock ( );
return;
}
stock MyStock ( /* ... */ )
{
for ( new i_Index = 1; i_Index <= gi_MaxPlayers; i_Index++ )
{
if ( ! IsClientInGame ( i_Index ) || ! IsPlayerAlive ( i_Index ) )
continue;
PrintToChat ( i_Index,"test" );
}
}
I'm the only one connected to the server and it doesn't prints me that message, nor i receive some error in the server console. What's the problem? thanks
EDIT: ok so i kinda fixed it, i think the problem was that i have maxclients set to 16, i just put 32 or random number instead of the index and it works...but why?
EDIT2: Now i'm getting this error and it bothers me for a while
L 01/02/2012 - 20:09:02: [SM] Native "IsClientInGame" reported: Client index 17 is invalid
L 01/02/2012 - 20:09:02: [SM] Displaying call stack trace for plugin "who.smx":
L 01/02/2012 - 20:09:02: [SM] [0] Line 79, C:\sourcemod\scripting\who.sp::HookBulletImpa ct()
the code is like this
for ( new i_Player = 1; i_Player <= 32; i_Player++ )
{
if ( ! ( IsClientInGame ( i_Player ) && ! IsPlayerAlive ( i_Player ) ) )
continue;
// stuff...