Raised This Month: $ Target: $400
 0% 

[SM] Native "GetClientTeam" reported: Client index 0 is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 03-28-2015 , 12:20   [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #1

Line 222 is the problem
Line 222, vip.sp::OnRoundStart()


This is the 222 line:

if(GetClientTeam(client) > 1)


And this is the all area of code:

Quote:
}

public OnClientSettingsChanged(client)
{
change_tag(client);
change_name(client);
}

public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
change_tag(GetClientOfUserId(GetEventInt(even t, "userid")));
IsValideRegen[client] = false;

if (GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
{
SetEntityGravity(client, 1.0);
SetEntityRenderMode(client, RENDER_TRANSCOLOR);
SetEntityRenderColor(client, 255, 255, 255, 255);
}

PlayerRespawn[client] = 0;

return Plugin_Handled;
}

public change_tag(client)
{
if (IsClientInGame(client) && Clan_Tag == 1)
{
if (GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
{
CS_SetClientClanTag(client, g_sVip);
}
else
{
CS_SetClientClanTag(client, "");
}
}
}

public OnClientPutInServer(client)
{
change_name(GetClientOfUserId(client));
}

public change_name(client)
{
decl String:name[32];
GetClientName(client, name, sizeof(name));
if (GetUserFlagBits(client) & ADMFLAG_CUSTOM1 && Vip_Name == 1 && StrContains(name, "[VIP]") == -1)
{
new String:new_name[64];
Format(new_name, 64 ,"[VIP] %s", name);
CS_SetClientName(client, new_name,true);
}
}

public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
for(new i = 1; i <= MaxClients; i++)
{
HasMenu[i] = false;
HasUseMenu[i] = false;
menu_times[i] = 0;
}
if(GetClientTeam(client) > 1)
{
CPrintToChatAll("\x04 Scrie {%s} !vipmenu pentru a deschide meniul VIP", TagTeam);
}
}
When plugin try to change name of the player with VIP doesn't work, instead [VIP] Razvan the plugin change to: name

And also this error appear in Logs:

[SM] Native "GetClientTeam" reported: Client index 0 is invalid

Please help me!

Last edited by Razvann.; 03-28-2015 at 12:25.
Razvann. is offline
Send a message via Yahoo to Razvann.
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-28-2015 , 12:22   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #2

There is no userid in the round start event - so you are getting the client of 0, which will always be 0.

Also, this might not effect changing player array bools and ints but you want to make sure the players in your for loop are in game.

Last edited by Darkness_; 03-28-2015 at 12:46.
Darkness_ is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 03-28-2015 , 12:28   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #3

Client 0 is the console/world entity. It's not a player.

If OnRoundStart is based on an actual start of a round of gameplay, then WHAT PLAYER is supposed to be being passed through the event through "userid"? Do you even know why that GetEventInt line is in there?
__________________

Last edited by ddhoward; 03-28-2015 at 12:29.
ddhoward is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 03-28-2015 , 12:28   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #4

Can you help me with the right code? To work
[SM] Native "GetClientTeam" reported: Client index 0 is invalid
this appear in Logs, i want to remove this error, if you can't help me with TAG i only want the error above to disappear.



ddhoward: i dont know why you said is in plugin, i only downloaded and try on my server (csgo), is a VIP plugin, was dedicated for CSS, but i change some lines and now works on CS:GO, but the error above appear and i dont know how to fix.

Last edited by Razvann.; 03-28-2015 at 12:31.
Razvann. is offline
Send a message via Yahoo to Razvann.
Miu
Veteran Member
Join Date: Nov 2013
Old 03-28-2015 , 12:34   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #5

it's not clear what you're trying to do, if you want it to print for all players, change it to

Code:
public Action:OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for(new i = 1; i <= MaxClients; i++)
{
HasMenu[i] = false;
HasUseMenu[i] = false;
menu_times[i] = 0;
}
CPrintToChatAll("\x04 Scrie {%s} !vipmenu pentru a deschide meniul VIP", TagTeam);
}

Last edited by Miu; 03-28-2015 at 12:35.
Miu is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 03-28-2015 , 12:37   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #6

The plugin was created for CS:S and i changed few lines to work on CS:GO
But now [SM] Native "GetClientTeam" reported: Client index 0 is invalid this error appear, and i dont know how to fix this.

The plugin in same time have CLAN TAG function, plugin put [VIP] in front of the name, but doesn't work, is only changed to NAME


EDIT: I think the plugin when the error appear is trying to send message to VIP person (flag O) but the functions is wrong, and i dont know how to fix this.

I hope you understand my english...

Last edited by Razvann.; 03-28-2015 at 12:41.
Razvann. is offline
Send a message via Yahoo to Razvann.
Mitchell
~lick~
Join Date: Mar 2010
Old 03-28-2015 , 12:41   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #7

Quote:
Originally Posted by Razvann. View Post
The plugin was created for CS:S and i changed few lines to work on CS:GO
But now [SM] Native "GetClientTeam" reported: Client index 0 is invalid this error appear, and i dont know how to fix this.

The plugin in same time have CLAN TAG function, plugin put [VIP] in front of the name, but doesn't work, is only changed to NAME


I hope you understand my english...
just do a
Code:
if(client > 0) {
//stuff
}
Before the checking of the client's team. As other said before me client 0 is the world, and you shouldnt have to check it's team, etc.
Mitchell is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 03-28-2015 , 12:46   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #8

So instead:

if(GetClientTeam(client) > 1)
{
CPrintToChatAll("\x04 Scrie {%s} !vipmenu pentru a deschide meniul VIP", TagTeam);
}

i put if(client > 0) ?

Last edited by Razvann.; 03-28-2015 at 12:47.
Razvann. is offline
Send a message via Yahoo to Razvann.
Darkness_
Veteran Member
Join Date: Nov 2014
Old 03-28-2015 , 12:51   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #9

Quote:
Originally Posted by Razvann. View Post
So instead:

if(GetClientTeam(client) > 1)
{
CPrintToChatAll("\x04 Scrie {%s} !vipmenu pentru a deschide meniul VIP", TagTeam);
}

i put if(client > 0) ?
You are using CPrintToChatAll() - why would you need to check the team of a non-existent client before printing this?

What you could do is
PHP Code:
public Action OnRoundStart(Event event, const char[] namebool dontBroadcast) {
    for (
int i 1<= MaxClientsi++) {
        if (!
IsClientInGame(i)) continue;
        
HasMenu[i] = false;
        
HasUseMenu[i] = false;
        
menu_items[i] = 0;
        if (
GetClientTeam(i) > 1) {
            
CPrintToChat(i"\x04 Scrie {%s} !vipmenu pentru a deschide meniul VIP"TagTeam);
        }
    }
    return 
Plugin_Continue;


Last edited by Darkness_; 03-28-2015 at 14:58.
Darkness_ is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 03-28-2015 , 12:56   Re: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
Reply With Quote #10

Darkness, now when i try to Compile errors appear:

[IMG]http://s1.************/6jym7lbmn/Snapshot_2015_03_28_185551.png[/IMG]

PS: I use 1.6.4 compiler, i dont want to change this compiler because plugin will not work (plugin have many old functions).

Last edited by Razvann.; 03-28-2015 at 13:08.
Razvann. is offline
Send a message via Yahoo to Razvann.
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 12:39.


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