|  | 
	|  | 
	|  | 
	| 
		
			| Scripts.dll help [message #96486] | Mon, 21 June 2004 17:59   |  
			| 
				
				
					|  thinlan Messages: 25
 Registered: July 2003
 
	Karma: 0
 | Recruit |  |  |  
	| ok well never mind all them.. but is it possible to detect what soemone says ingame using scripts.dll? |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96487] | Mon, 21 June 2004 18:33   |  
			|  |  
	| no its not possible. 
 Jonathan Wilson aka Jonwil
 Creator and Lead Coder of the Custom scripts.dll
 Renegade Engine Guru
 Creator and Lead Coder of TT.DLL
 Official member of Tiberian Technologies
 
 |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96490] | Mon, 21 June 2004 18:44   |  
			| 
				
				
					|  xptek_disabled Messages: 1308
 Registered: September 2003
 
	Karma: 0
 | General (1 Star) |  |  |  
	| A certain awesome scripts.dll mod does it by adding new commands to the FDS. 
 EX: Admin types !kill xptek
 
 Bot issues renrem kill player
 
 Local oper-irc.ugin.net - A Scrumfy free IRC.
 Jonwil > SK
 http://www.byterush.net/
 |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96494] | Mon, 21 June 2004 19:02   |  
			| 
				
				
					|  thinlan Messages: 25
 Registered: July 2003
 
	Karma: 0
 | Recruit |  |  |  
	| yes i already knew about that, but i have not the slightest idea how to do it :S |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96544] | Tue, 22 June 2004 02:05   |  
			| 
				
				|  | gibberish Messages: 366
 Registered: May 2003
 
	Karma: 0
 | Commander |  |  |  
	| | thinlan |  | i have not the slightest idea how to do it
 
 | 
 
 - Spawn a thread inside scripts.dll
 - Create a server server socket and listen for incoming connections.
 - Open an outgoing socket from your regulator.
 - The regulator parses the log file generated by the FDS.
 - If the regulator sees a command it forwards it over the socket to the FDS
 - Then the thread in scripts.dll queues the command.
 - Have a timer set to read the queue from the main thread (every second) and then the main thread executes the command (Kill player, move player, give money .........).
 
 Additionally you can feed information about kills and such back the other way so that the regulator can do stuff with it.
 
 Alternatively just write your regulator in C and compile it into scripts.dll that way you don't have to spawn any threads or do any network programming.
 But the disadvantage is that if you need to update the regulator you have to stop the FDS.
 |  
	|  |  | 
	|  | 
	| 
		
			| Scripts.dll help [message #96672] | Tue, 22 June 2004 14:02   |  
			| 
				
				|  | gibberish Messages: 366
 Registered: May 2003
 
	Karma: 0
 | Commander |  |  |  
	| The first option requires Multi-Threaded Socket Programming this is an advanced area. Don't bother even trying to do it unless you are a experianced C++ programmer. This leaves you with the second option: 
 In English the second option is:
 
 When the FDS (Free Dedicated Server) is running it writes a log file containing many things that happen in the game.
 
 What you need to do is get the source code for scripts.dll.
 
 Then add some new code to it to read the log file.
 That way when someone chats something it will appear in the log.
 Your program will read the log and hence know it must do something....
 |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96756] | Tue, 22 June 2004 22:30   |  
			| 
				
				
					|  thinlan Messages: 25
 Registered: July 2003
 
	Karma: 0
 | Recruit |  |  |  
	| ok im getting no where with it.. how can u add a command to the fds so u can renrem it like xptek was saying? |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96757] | Tue, 22 June 2004 22:32   |  
			| 
				
				
					|  thinlan Messages: 25
 Registered: July 2003
 
	Karma: 0
 | Recruit |  |  |  
	| also is it possible to increase the vehicle limit using scripts.dll cos that would be so 0wnage |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96778] | Wed, 23 June 2004 01:38   |  
			| 
				
				|  | gibberish Messages: 366
 Registered: May 2003
 
	Karma: 0
 | Commander |  |  |  
	| | thinlan |  | ok im getting no where with it.. how can u add a command to the fds so u can renrem it like xptek was saying?
 
 | 
 
 Don't, just call ConsoleCommand
 
 
 
void ConsoleCommand(const char *msg)
{
	typedef void (*ConsoleMsg)(const char *);
	ConsoleMsg do_consolemsg;
	do_consolemsg = (ConsoleMsg)0x00428960;
	do_consolemsg(msg);
}
 Eg: ConsoleCommand("MSG Hello World")
 |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96780] | Wed, 23 June 2004 02:18   |  
			| 
				
				
					|  thinlan Messages: 25
 Registered: July 2003
 
	Karma: 0
 | Recruit |  |  |  
	| well take for example that !kill command.. if i wanted to make one of those.. appart from the confusing things stated earlyer how could i make a new fds command.. like when someone type !kill thinlan, blazeregulator or what ever can renrem kill thinlan, and the issue the Apply_Damage command to kill em.. i mean i know how to do the apply damage stuff i just dont know how to make the new fds command, or can u use Consolecommand to do that? |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96814] | Wed, 23 June 2004 08:06   |  
			| 
				
				
					|  Tidu Messages: 62
 Registered: January 2004
 
	Karma: 0
 | Recruit |  |  |  
	| | thinlan |  | also is it possible to increase the vehicle limit using scripts.dll cos that would be so 0wnage
 
 | 
 
 
 
 
 That would lag the game a lot;
 |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96846] | Wed, 23 June 2004 11:30   |  
			| 
				
				
					|  xptek_disabled Messages: 1308
 Registered: September 2003
 
	Karma: 0
 | General (1 Star) |  |  |  
	| I can make the vehicle limit unlimited, it's not done with scripts.dll though. If you have a good enough server and a good enough computer there's no lag. 
 Local oper-irc.ugin.net - A Scrumfy free IRC.
 Jonwil > SK
 http://www.byterush.net/
 |  
	|  |  | 
	|  | 
	| 
		
			| Scripts.dll help [message #96859] | Wed, 23 June 2004 12:28   |  
			| 
				
				|  | gibberish Messages: 366
 Registered: May 2003
 
	Karma: 0
 | Commander |  |  |  
	| 
 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.
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Scripts.dll help [message #96868] | Wed, 23 June 2004 12:50   |  
			| 
				
				
					|  Phoenix - Aeon Messages: 221
 Registered: April 2004
 
	Karma: 0
 | Recruit |  |  |  
	| Fuck, from the looks of things it's not hard to run the kill either, it's the player locate coding that takes up lines. |  
	|  |  | 
	| 
		
			| Scripts.dll help [message #96873] | Wed, 23 June 2004 13:07   |  
			| 
				
				|  | gibberish Messages: 366
 Registered: May 2003
 
	Karma: 0
 | Commander |  |  |  
	| | Phoenix - Aeon |  | Fuck, from the looks of things it's not hard to run the kill either, it's the player locate coding that takes up lines.
 
 | 
 
 Its still a significant project it will probably take a newbie at least a couple of days of work to put it all together.
 
 But after doing it you will have a good grasp of scripts.dll programming.
 |  
	|  |  | 
	|  | 
	|  |