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

Props/Equip on FakeClients (bots)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cosmo1337
Junior Member
Join Date: Feb 2020
Old 02-01-2020 , 08:54   Props/Equip on FakeClients (bots)
Reply With Quote #1

Hi guys,
Need help on solving this puzzle, have this code:

Code:
public void Event_OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));
	if(!client)
		return;
	if(botClientId == client && IsClientInGame(client) && IsPlayerAlive(client) && IsFakeClient(client) && GetClientTeam(client) >= CS_TEAM_T)
	{
		Client_RemoveAllWeapons(client);//works
                TeleportEnity(.....); //works
		EquipPlayerWeapon(client, CSWeapon_AK47);//exception Client X is not in game.
	}
}
Getting exception on EquipPlayerWeapon(client, CSWeapon_AK47) or SetEntityProp(client,..).. Exception reported: Client X is not in game.

While Client_RemoveAllWeapons(client) works, TeleportEntity works, setting client model works, have no idea...

Last edited by Cosmo1337; 02-01-2020 at 08:57.
Cosmo1337 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 02-05-2020 , 19:20   Re: Props/Equip on FakeClients (bots)
Reply With Quote #2

EquipPlayerWeapon takes a the index of a created weapon entity to equip, not a CSWeapon ID.

It is displaying the wrong error message, the problem is that CSWeapon_AK47 is not a valid entity index.
__________________
asherkin is offline
Cosmo1337
Junior Member
Join Date: Feb 2020
Old 02-21-2020 , 06:41   Re: Props/Equip on FakeClients (bots)
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
EquipPlayerWeapon takes a the index of a created weapon entity to equip, not a CSWeapon ID.

It is displaying the wrong error message, the problem is that CSWeapon_AK47 is not a valid entity index.
Ty, fixed my issue Added "give item" before equip)
Cosmo1337 is offline
Reply


Thread Tools
Display Modes

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 14:58.


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