!tdonate [message #339723] |
Tue, 08 July 2008 09:54 |
|
marcin205
Messages: 178 Registered: March 2007 Location: Poland
Karma: 0
|
Recruit |
|
|
Hi,how to make tdonate script?
|
|
|
|
|
|
|
Re: !tdonate [message #339834 is a reply to message #339814] |
Tue, 08 July 2008 19:11 |
|
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 #339891 is a reply to message #339723] |
Wed, 09 July 2008 01:22 |
|
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 #339928 is a reply to message #339723] |
Wed, 09 July 2008 08:12 |
|
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
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 |
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 |
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 |
|
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 |
=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 #339972 is a reply to message #339933] |
Wed, 09 July 2008 13:38 |
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 |
|
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 |
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 |
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 |
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 #339986 is a reply to message #339974] |
Wed, 09 July 2008 14:27 |
|
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 |
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?
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.
|
|
|
|
|