Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Scripts.dll help
Scripts.dll help [message #96859] Wed, 23 June 2004 12:28 Go to previous messageGo to previous message
gibberish
Messages: 366
Registered: May 2003
Karma:
Commander
thinlan

!kill thinlan


I don't know of a way to do it from the console however if you want to do it from the chat (F2) then !kill the only other code you need is the code to get a player name:

unsigned long GetPlayerData(GameObject *obj)
{
	if (!obj)
		return 0;

	__asm {
	   mov edx, obj
	   mov eax, dword ptr[edx + 960h]
	};
} 
  
LPCWSTR GetName(unsigned long ptr_)
{ 
	if (!ptr_)
		return NULL;

	__asm {
		mov edx, [ptr_]
		mov eax, dword ptr[edx + 758h]
	};
}

LPSTR GetPlayerNameA(GameObject *obj)
{
	LPCWSTR lpszSource = GetName(GetPlayerData(obj));

	return wcstombsnew(lpszSource);
}


LPCWSTR GetPlayerNameW(GameObject *obj)
{
	return (LPCWSTR) GetName(GetPlayerData(obj));
}

char *wcstombsnew(LPCWSTR lpszSource)
{
	if (!lpszSource)
		return NULL;

	// Add 1 to include null terminator
	size_t stLen = wcslen(lpszSource);
	size_t stZero = stLen + 1;

	// Calculate how much space is needed
	size_t stNew = wcstombs(NULL, lpszSource, stZero);

	if (stNew == ((size_t) -1))
		return NULL;

	char *lpszTarget = new char [stNew + 1];

	wcstombs(lpszTarget, lpszSource, stZero);

	return lpszTarget;
}

// Version of wcsdup that uses new instead of malloc
LPWSTR wcsdupnew(LPCWSTR lpszSource)
{
	if (!lpszSource)
		return NULL;

	// Copy the wide string
	size_t st_len = wcslen(lpszSource);
	LPWSTR lpszTarget = new WCHAR[st_len + 1];
	wcscpy(lpszTarget, lpszSource);

	return lpszTarget;
}



Everything you need is now in this thread.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Scripts.dll
Next Topic: Taximes PT Icons
Goto Forum:
  


Current Time: Thu Sep 12 19:31:14 MST 2024

Total time taken to generate the page: 0.01073 seconds