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

CS_SwitchTeam


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 05-31-2011 , 13:53   CS_SwitchTeam
Reply With Quote #1

Can anybody help me? I have tried to find CCSPlayer::SwitchTeam offset in vtable dump on this page: http://wiki.alliedmods.net/CCSPlayer...Strike:_Source), but this page does not contains offset of this function. Does anybody know another way to call this function?

Ps. sorry for my bad english.

Last edited by Yeah=}; 05-31-2011 at 14:01.
Yeah=} is offline
Benjamin1995
SourceMod Donor
Join Date: May 2009
Location: Germany
Old 05-31-2011 , 14:57   Re: CS_SwitchTeam
Reply With Quote #2

Hi,

Just use this function:
native CS_SwitchTeam(client, team);
__________________
Benjamin1995 is offline
Send a message via Skype™ to Benjamin1995
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 05-31-2011 , 15:03   Re: CS_SwitchTeam
Reply With Quote #3

Quote:
Originally Posted by Benjamin1995 View Post
Hi,

Just use this function:
native CS_SwitchTeam(client, team);
Thanks, but I need this function in metamod!
Yeah=} is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 05-31-2011 , 15:11   Re: CS_SwitchTeam
Reply With Quote #4

I have tried to use this code, but it does not work as I want.

SetEntityProperty(m_Game_DLL, *i, "CCSPlayer", "m_iClass", GET_PLAYER_CLASS(*i) + 4);
SetEntityProperty(m_Game_DLL, *i, "CBaseEntity", "m_iTeamNum", Player_CounterTerrorist);
Yeah=} is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-31-2011 , 15:23   Re: CS_SwitchTeam
Reply With Quote #5

Quote:
Originally Posted by Yeah=} View Post
Can anybody help me? I have tried to find CCSPlayer::SwitchTeam offset in vtable dump on this page: http://wiki.alliedmods.net/CCSPlayer...Strike:_Source), but this page does not contains offset of this function. Does anybody know another way to call this function?

Ps. sorry for my bad english.
It doesn't exist in the CCSPlayer vtable so you cannot call it by offset. You would have to find it by byte signature (or even symbol name if mac/linux) like SM's Cstrike Extension does.

You can even copy some of the helper functions from SM (such as in MemoryUtils) if you're either not distributing your plugin or are distributing it under the terms of the GPL.
psychonic is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 06-01-2011 , 03:45   Re: CS_SwitchTeam
Reply With Quote #6

I have used functions from sourcemod, but it crash my server.

Code:
inline void CS_SwitchTeam(edict_t* pEntity, int team)
{
	typedef void (*MemFunc)(int);

	unsigned char *base = nullptr;
	size_t len = NULL;

	MemFunc Func = (MemFunc)FindPattern(GetModuleHandle("server.dll"), MKSIG(SwitchTeam));

	CBaseEntity *Ent = pEntity->GetUnknown()->GetBaseEntity();

	__asm
	{
		mov ecx, Ent
		push team
		call Func
	}
}
What's wrong?
Yeah=} 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 15:43.


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