Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » !tdonate  () 2 Votes
!tdonate [message #339723] Tue, 08 July 2008 09:54 Go to next message
marcin205 is currently offline  marcin205
Messages: 178
Registered: March 2007
Location: Poland
Karma: 0
Recruit
Hi,how to make tdonate script?

Re: !tdonate [message #339734 is a reply to message #339723] Tue, 08 July 2008 11:19 Go to previous messageGo to next message
bmruze is currently offline  bmruze
Messages: 62
Registered: March 2006
Location: South Carolina
Karma: 1
Recruit

By "tdonate" are you wanting to donate money to a team or just an individual player?

https://content.screencast.com/users/bmruze/folders/Jing/media/b3acb17d-6b52-4e10-8183-eae956a12446/2017-09-02_0843.png
Re: !tdonate [message #339754 is a reply to message #339723] Tue, 08 July 2008 12:57 Go to previous messageGo to next message
marcin205 is currently offline  marcin205
Messages: 178
Registered: March 2007
Location: Poland
Karma: 0
Recruit
to individual player like !tdonate 3000 and all players have some parts of this credits

Re: !tdonate [message #339774 is a reply to message #339723] Tue, 08 July 2008 14:28 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
I'm using the chathook and a tokenizer.

Or what is your question?


Bückstabü!
Re: !tdonate [message #339814 is a reply to message #339723] Tue, 08 July 2008 17:57 Go to previous messageGo to next message
Lone0001 is currently offline  Lone0001
Messages: 2112
Registered: August 2006
Location: Ontario, Canada
Karma: 0
General (2 Stars)

I think they want a !tdonate command made for them which really I can't see happening, use Brenbot it has a !tdonate command.

Re: !tdonate [message #339834 is a reply to message #339814] Tue, 08 July 2008 19:11 Go to previous messageGo to next message
marcin205 is currently offline  marcin205
Messages: 178
Registered: March 2007
Location: Poland
Karma: 0
Recruit
{SB}Lone0001 wrote on Tue, 08 July 2008 19:57

I think they want a !tdonate command made for them which really I can't see happening, use Brenbot it has a !tdonate command.
ok thx but what is chathook and a tokenizer anyway?


[Updated on: Tue, 08 July 2008 19:12]

Report message to a moderator

Re: !tdonate [message #339835 is a reply to message #339723] Tue, 08 July 2008 19:15 Go to previous messageGo to next message
Lone0001 is currently offline  Lone0001
Messages: 2112
Registered: August 2006
Location: Ontario, Canada
Karma: 0
General (2 Stars)

They are functions used in the code(done in C++).

Re: !tdonate [message #339891 is a reply to message #339723] Wed, 09 July 2008 01:22 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Am I right in understanding you want a player to be able to donate a certain amount of hos money to the entire team?

So he might say !tdonate 400, and the four players on his team each get 100 credits?



Re: !tdonate [message #339910 is a reply to message #339723] Wed, 09 July 2008 04:36 Go to previous messageGo to next message
marcin205 is currently offline  marcin205
Messages: 178
Registered: March 2007
Location: Poland
Karma: 0
Recruit
sure

Re: !tdonate [message #339928 is a reply to message #339723] Wed, 09 July 2008 08:12 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Try this out then, I havn't tested it, so if you could and report any bugs that would be nice, as I plan to use it myself too.

class tdonateChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
if (!Text[1].empty()) {
	float money = atof(Text[1].c_str());

/*const char* s_money = Text[1].c_str();
sscanf(s_money,"%f",&money);
if (sscanf(s_money,"%f",&money) != 1)
{
	Console_Output("There was blood, everywhere. Nobody could tell what did this to them, but there was one thing for certain. Something had gone horribly wrong.");
}
*/

float clientsmoney = Commands->Get_Money(obj);

if(clientsmoney >= money){
int Team = Get_Team(ID);
int count = Get_Team_Player_Count(Team);
if(count > 1){
int amounttodonate = money/(count - 1);
Commands->Give_Money(obj,(money * -1),false);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x){
GameObject *o = (GameObject *)x->NodeData;
if (o && Commands->Is_A_Star(o) && (Commands->Get_Player_Type(o) == Team)){
	if(Get_Player_ID(o) != ID){
Commands->Give_Money(o,amounttodonate,false);
Console_Input(StrFormat("ppage %d You have just been donated $%i by player %s.",Get_Player_ID(o),amounttodonate,Get_Player_Name(obj)).c_str());
	}
}
x = x->NodeNext;
}
}
else{
	Console_Input(StrFormat("ppage %d Dude, you're the only player on your team :-S",ID).c_str());
}
}
else{
Console_Input(StrFormat("ppage %d You do not have $%i, please lower your donation.",ID,money).c_str());
}
}
}
};
ChatCommandRegistrant<tdonateChatCommand> tdonateChatCommandReg("!tdonate",CHATTYPE_ALL,1,GAMEMODE_ALL);


There's probably some casts I havn't done that I should of, but I'm a lazy bitch and keep my warning levels down all the time.
You're probably able to make it say some weird numbers if you type !tdonate 34098563406854968409680954870986504, but it shouldn't actually do any harm.

Feel free anyone to pop there two cents in and make it better Smile



Oh, I also found a flaw with int Get_Team_Player_Count(int Team), so you'll need to change that function to read like this:

int Get_Team_Player_Count(int Team)
{
	int Total = 0;
	GenericSLNode *x = BaseGameObjList->HeadNode;
	while (x)
	{
		GameObject *o = (GameObject *)x->NodeData;
		if (o && Commands->Is_A_Star(o))
		{
			if (Get_Team(Get_Player_ID(o)) == Team)
			{
			Total++;
		}
		}
		x = x->NodeNext;
	}
	return Total;
}



[Updated on: Wed, 09 July 2008 08:16]

Report message to a moderator

Re: !tdonate [message #339931 is a reply to message #339928] Wed, 09 July 2008 09:06 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
They reborn, do you just write those codes down? or do you copy paste some stuff?

This account is no longer being active.
Re: !tdonate [message #339933 is a reply to message #339723] Wed, 09 July 2008 09:14 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
He writes the stuff himself, rather then looking though other peoples soruce and calling it their own.
Re: !tdonate [message #339939 is a reply to message #339723] Wed, 09 July 2008 09:54 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Actually if I'm honest I do look at other peoples code. I recycled allot of vloktboky's code from previous releases into other work. Granted I didn't copy it line for line, but there are allot of similarities here and there in hunt the player mode and the base defense plug-in and that of boky's deathmatch mode and other releases.
I didn't know or had never tried to convert a const char * type to float until today, I asked both Stealth Eye and Saber Hawk and they kindly replied. I ended up using Stealth Eye's suggestion and took a look at atof, which ended up forming this line "float money = atof(Text[1].c_str());".

Asking people for help is not a bad thing. Some people are embarassed to do so, or don't want to annoy people. If someone asks me and I know then I will help them, unless they are an asshole.
If I'm busy then I will say I'm busy.. I have found this works with others. I ask Roshambo, WD, SaberHawk and StealthEye for help all the time. Sometimes I even manage to get-a-hold of boky...

If you're ego is so large that you cannot ask someone for help then you're not going to get very far at all in life. It's easier for me, I practice meditation and actively try to free myself from ego, but I can see why others have a hard time.


But yes, you're right. Copying other peoples code line for line and then calling it your own, or just changing a little thing here or there is pretty lame.



Re: !tdonate [message #339941 is a reply to message #339723] Wed, 09 July 2008 10:10 Go to previous messageGo to next message
=HT=T-Bird is currently offline  =HT=T-Bird
Messages: 712
Registered: June 2005
Karma: 0
Colonel
Give credit where credit is due, but don't be loathe to ask others for help. I've had to head to the #c++ channel on Freenode quite a few times because I have had questions about C++ itself as well as asking StealthEye or Ghostshaw for help, RoShamBo and Saberhawk are good resources too.


BTW: get a good C++ book. I have heard very good things about Koenig's "Accelerated C++" as a starting point. Once you work through that, you should be ready for Stroustrup's "The C++ Programming Language, 3rd edition". Don't try to learn C++ from the scripts...because they have some very ugly, poorly-encapsulated code and lots of reinvented wheels.


HTT-Bird (IRC)
HTTBird (WOL)
Proud HazTeam Lieutenant.
BlackIntel Coder & Moderator.

If you have trouble running BIATCH on your FDS, have some questions about a BIATCH message or log entry, or think that BIATCH spit out a false positive, PLEASE contact the BlackIntel coding team and avoid wasting the time of others.
Re: !tdonate [message #339962 is a reply to message #339723] Wed, 09 July 2008 12:08 Go to previous messageGo to next message
marcin205 is currently offline  marcin205
Messages: 178
Registered: March 2007
Location: Poland
Karma: 0
Recruit
nice stuff Big Grin thx

Re: !tdonate [message #339972 is a reply to message #339933] Wed, 09 July 2008 13:38 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
cnc95fan wrote on Wed, 09 July 2008 12:14

He writes the stuff himself, rather then looking though other peoples soruce and calling it their own.

To be honest, you just failed. And i do copy paste other peoples codes, but i write alot of codes too. So, would you mind your own bussines and leave me the fuck alone..



This account is no longer being active.
Re: !tdonate [message #339973 is a reply to message #339972] Wed, 09 July 2008 13:40 Go to previous messageGo to next message
sadukar09 is currently offline  sadukar09
Messages: 2812
Registered: May 2007
Location: Ottawa,Canada
Karma: 0
General (2 Stars)
HeavyX101 wrote on Wed, 09 July 2008 15:38

cnc95fan wrote on Wed, 09 July 2008 12:14

He writes the stuff himself, rather then looking though other peoples soruce and calling it their own.

To be honest, you just failed. And i do copy paste other peoples codes, but i write alot of codes too. So, would you mind your own bussines and leave me the fuck alone..



Would you like to be sued for copyright and/or plagiarism?


Quote:

[19:16:48] <APBBR> @ryan3k: THE ENFIELD DEFIES THE LAWS OF PHYSICS BECAUSE THE BULLETS INSTANTLY HIT THEIR TARGETS LOL
[19:16:52] <APBBR> @ryan3k: CHRONO TECHNOLOGY IN TEH BULLETS


Quote:

[22:48]<APBBR> @V0LK0V: AOL COMING UR WAI K
[22:48] <APBBR> Host: Quitting due to Westwood Online connection loss.

Re: !tdonate [message #339974 is a reply to message #339973] Wed, 09 July 2008 13:45 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
sadukar09 wrote on Wed, 09 July 2008 16:40

HeavyX101 wrote on Wed, 09 July 2008 15:38

cnc95fan wrote on Wed, 09 July 2008 12:14

He writes the stuff himself, rather then looking though other peoples soruce and calling it their own.

To be honest, you just failed. And i do copy paste other peoples codes, but i write alot of codes too. So, would you mind your own bussines and leave me the fuck alone..



Would you like to be sued for copyright and/or plagiarism?

People who made those codes just release them and i use them, every one does.


This account is no longer being active.
Re: !tdonate [message #339976 is a reply to message #339928] Wed, 09 July 2008 13:48 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
/*const char* s_money = Text[1].c_str();
sscanf(s_money,"%f",&money);
if (sscanf(s_money,"%f",&money) != 1)
{
	Console_Output("There was blood, everywhere. Nobody could tell what did this to them, but there was one thing for certain. Something had gone horribly wrong.");
}
*/




Umm, reborn, what is that? It is from your code.


This account is no longer being active.
Re: !tdonate [message #339978 is a reply to message #339976] Wed, 09 July 2008 14:02 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Sorry for double post.
I got this error while compiling:
Error	1	error C2220: warning treated as error - no 'object' file generated	c:\Westwood\RenegadeFDS\Server\gmmain.cpp	2507





This account is no longer being active.
Re: !tdonate [message #339985 is a reply to message #339723] Wed, 09 July 2008 14:24 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I'll help anyone but cheaters, you're shit out of luck.


Re: !tdonate [message #339986 is a reply to message #339974] Wed, 09 July 2008 14:27 Go to previous messageGo to next message
sadukar09 is currently offline  sadukar09
Messages: 2812
Registered: May 2007
Location: Ottawa,Canada
Karma: 0
General (2 Stars)
HeavyX101 wrote on Wed, 09 July 2008 16:45

sadukar09 wrote on Wed, 09 July 2008 16:40

HeavyX101 wrote on Wed, 09 July 2008 15:38

cnc95fan wrote on Wed, 09 July 2008 12:14

He writes the stuff himself, rather then looking though other peoples soruce and calling it their own.

To be honest, you just failed. And i do copy paste other peoples codes, but i write alot of codes too. So, would you mind your own bussines and leave me the fuck alone..



Would you like to be sued for copyright and/or plagiarism?

People who made those codes just release them and i use them, every one does.

Not if reuse them and claim it was made by you. And it was triple post dipshit.


Quote:

[19:16:48] <APBBR> @ryan3k: THE ENFIELD DEFIES THE LAWS OF PHYSICS BECAUSE THE BULLETS INSTANTLY HIT THEIR TARGETS LOL
[19:16:52] <APBBR> @ryan3k: CHRONO TECHNOLOGY IN TEH BULLETS


Quote:

[22:48]<APBBR> @V0LK0V: AOL COMING UR WAI K
[22:48] <APBBR> Host: Quitting due to Westwood Online connection loss.

Re: !tdonate [message #339998 is a reply to message #339985] Wed, 09 July 2008 15:07 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
reborn wrote on Wed, 09 July 2008 17:24

I'll help anyone but cheaters, you're shit out of luck.

Why would you want to say something mean like that?
Sad
I just asked for help. Well, fine, i will find it out my self. It would be good for me, i will know what to do if it happens again.


This account is no longer being active.
Re: !tdonate [message #340038 is a reply to message #339723] Wed, 09 July 2008 19:10 Go to previous messageGo to next message
Creed3020 is currently offline  Creed3020
Messages: 1438
Registered: February 2003
Location: Toronto, Canada
Karma: 0
General (1 Star)
This is one fo the first releases I have seen in a while that I would actually like to implement but I haven't a clue how ti implement that code.

Could someone kindly point me in the correct direction to get started, after that I will give it a go. Thanks!
Re: !tdonate [message #340058 is a reply to message #339723] Wed, 09 July 2008 23:22 Go to previous messageGo to previous message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
Thx reborn for this. I will look on it on Saturday.
Previous Topic: Looking for Bot maps
Next Topic: Bot Waypaths
Goto Forum:
  


Current Time: Tue Dec 24 13:02:16 MST 2024

Total time taken to generate the page: 0.01137 seconds