View previous topic :: View next topic |
Author |
Message |
Skipper Warlock
Joined: 31 Mar 2007 Posts: 10
|
Posted: Mon Jun 02, 2008 6:40 Post subject: Need help writing my first plug-in. |
|
|
I've just started learning C++, and want to try to make an NWNX plug-in. What I need it to do is when a player logs in, a certain set of BIC files are moved into their servervault folder. I wrote a simple copy function for testing to see if I could get it to work, but have been unsuccessful so far.
Here's the copy function:
Code: |
#include <windows.h>
#include <stdio.h>
void main()
{
SHFILEOPSTRUCT fileop;
fileop.hwnd = NULL;
fileop.wFunc = FO_COPY;
fileop.pFrom = "C:\\test\\test.txt";
fileop.pTo = "c:\\test\\test2\0";
fileop.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR;
if (!SHFileOperation(&fileop));
{
printf("Copy Failed\n");
system("PAUSE");
}
}
|
I have read through pretty much every topic in this forum and tutorial1 and can't seem to figure out how to do this I appreciate any help you guys can give me. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Mon Jun 02, 2008 21:00 Post subject: |
|
|
Before we discuss code, maybe you could elaborate a bit on what you are actually trying to achieve ?
The BIC files are moved into the players directory for what reason ? Why haven't they already been there, or if they have been deleted, how ? _________________ Papillon |
|
Back to top |
|
|
Skipper Warlock
Joined: 31 Mar 2007 Posts: 10
|
Posted: Mon Jun 02, 2008 21:49 Post subject: |
|
|
thanks for the reply.
The reason I want to move BIC files is because I want everyone to have the same characters available to them. I'm making a new type of server, and one of the things that it will require is for everyone to be able to choose from a set group of default characters. |
|
Back to top |
|
|
Skipper Warlock
Joined: 31 Mar 2007 Posts: 10
|
Posted: Sat Jun 07, 2008 20:13 Post subject: |
|
|
*bump* >_< |
|
Back to top |
|
|
Skywing
Joined: 03 Jan 2008 Posts: 321
|
Posted: Sun Jun 08, 2008 17:11 Post subject: |
|
|
As a general Win32 programming suggestion, you should look at CopyFile instead of SHFileOperation for this, in general. I would only use SHFileOperation if you are dealing with things that might be special virtual shell objects. |
|
Back to top |
|
|
Skipper Warlock
Joined: 31 Mar 2007 Posts: 10
|
Posted: Mon Jun 09, 2008 1:09 Post subject: |
|
|
Thanks, I'll take a look at that. But can anyone tell me if it is possible to make this into an nwnx plug-in and lead me in the right direction to do that? |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Jun 29, 2008 10:51 Post subject: |
|
|
I do not think this would work - scripts only fire after a player has already logged in, and this happens long after the BIC file has been chosen... _________________ Papillon |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Sun Jun 29, 2008 16:04 Post subject: |
|
|
Yep - what would have to happen in your case is to hook the event that gives the message "connection attempt made by: xyz" in the server logs. At that point the server does some stuff before showing the player the list of characters. You could then move the bic files over before accepting the connection.
I don't know what you'd have to hook though. |
|
Back to top |
|
|
|