Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » FTP Uploader script
Re: FTP Uploader script [message #411806 is a reply to message #411805] Sat, 21 November 2009 23:26 Go to previous messageGo to previous message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma:
Colonel

Hex wrote on Sun, 22 November 2009 00:23

DWORD __stdcall Upload(void *)
{
	char Path[256];
	GetCurrentDirectoryA(52, Path);
    strcat(Path, "\\YourFile.txt");
	void *f = (void *)fopen(Path, "w");

	for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext)
	{
		cPlayer *p = (cPlayer *)PlayerIter->NodeData;
		if (p->IsActive)
		{
			const char *Nick = WideCharToChar(p->PlayerName);
			fprintf((FILE *)f, "Nick %s\tScore %.0f\tKills %d\tDeaths %d\n", Nick, p->Score.Get(), p->Kills.Get(), p->Deaths.Get());
			delete[] Nick;
		}
	}
	fclose((FILE *)f);

	HINTERNET intern = InternetOpen("YaRR", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
	if(!intern)
	{
		printf("Unable to open an internet - %d\n", GetLastError());
		return 0;
	}
	HINTERNET intern2 = InternetConnect(intern, "FTP Address", 21, "User Name", "Password", INTERNET_SERVICE_FTP, 0, 0);
 
	if(!intern2)
	{
		printf("Unable to open a connection.\n");
		InternetCloseHandle(intern);
		return 0;
	}
 
	char ftpstr[256];
	sprintf(ftpstr, "./%s/%s","FTP Root", Path);
	if(FtpPutFile(intern2, Path, ftpstr, FTP_TRANSFER_TYPE_BINARY, 0))
	{
		printf("Uploaded.\n");
	}
	else
	{
		printf("Upload failed.\n");
	}

	InternetCloseHandle(intern);
	return 0;
}


Reborn, this is why I don't normally post in this forum...

wow that explains where it goes..you coulda just said add to the ftp function i woulda got that....


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
 
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
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: !spy command help
Next Topic: Obelisk attack sequence
Goto Forum:
  


Current Time: Sun Dec 15 12:44:06 MST 2024

Total time taken to generate the page: 0.01414 seconds