Author |
Message |
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Sun Mar 30, 2008 11:52 am Post subject: |
|
|
|
|
p isn't the player's name. 'p' is a pointer to a whole structure containing all the player's data. To get the name of the player, you have to type p->name. p-> lets you access each member of the player's structure. p->pos is a vector containing the player's position, for example.
I suggest you get some plugin examples and try to understand them. Even the empty command.cpp file has a line containing exactly what you need, the !about and !help commands are already coded in there.
Also, if you have no experience with c++, do some tutorials first; Understanding pointers, classes and structs is a big plus. _________________ (Insert a bunch of dead links here) |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
Purge Episode I > Eposide III Jar-Jar is kool
Age:34 Gender: Joined: Sep 08 2004 Posts: 2018 Offline
|
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Sun Mar 30, 2008 2:53 pm Post subject: |
|
|
|
|
thanks purge, thats exacty what i needed |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Sun Mar 30, 2008 6:59 pm Post subject: |
|
|
|
|
i ran into another problem this is the code sendPrivate(p,"I rolled a "(int)odice1", "(int)odice2", and a "(int)odice3); |
and this is the compile error that VC++ gave me 1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2144: syntax error : 'int' should be preceded by ')'
1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2064: term does not evaluate to a function taking 0 arguments
1>c:\documents and settings\owner\desktop\programing\c++\a3 dll\tutorial\default\command.cpp(215) : error C2059: syntax error : ')' |
any one help? |
|
Back to top |
|
|
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Sun Mar 30, 2008 7:26 pm Post subject: |
|
|
|
|
you have to remember that
1+2+1+2+1+2+1=10
and
1212121 doesnt = 10
=/ _________________ SSC Distension Owner
SSCU Trench Wars Developer |
|
Back to top |
|
|
hellzyeeeeee Guest
Offline
|
Posted: Sun Mar 30, 2008 8:36 pm Post subject: |
|
|
|
|
oh so i have to add +, but how come like in cout u just do
cout<<"You rolled "<<number; |
and not
cout<<"You rolled"<<+number; |
|
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Sun Mar 30, 2008 9:41 pm Post subject: |
|
|
|
|
the << operator for ostream does it for you like the + operator does it for you with the String class
if you really want to know what's going on look for String::operator+ in the mervbot source _________________ SubSpace Discretion: A Third Generation SubSpace Client |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Mon Mar 31, 2008 4:46 pm Post subject: |
|
|
|
|
every time i fix one thing i get another problem ...
i tried this and it didnt compile
sendPrivate(p,"I rolled a "+(int)odice1+(string)", "+(int)odice2+(string)", and a "+(int)odice3);
|
also i tried this (it didn't compile either :S)
sendPrivate(p,"I rolled a "+(int)odice1+", "+(int)odice2+", and a "+(int)odice3); |
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Mon Mar 31, 2008 6:13 pm Post subject: |
|
|
|
|
change your ints to strings. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Mon Mar 31, 2008 7:15 pm Post subject: |
|
|
|
|
and then change your strings to Strings |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Tue Apr 01, 2008 4:47 pm Post subject: |
|
|
|
|
Ok, i finished that bot and fixed all the problems but im going to do something else and i have few questions
is there a source code the rampage.dll or any one sprees? or atleast is theree a way to access thee spree from your dll, like if you get a spree 3:0 the rampage.dll does whatever it wants like says you got a spree, while your DLL gives you like a thousand points if you got that spree
how to access flag game, like if you win a flag game say freq 0 won the flag game and give them points (i dont want the existing flag.dll i want to learn how to make my own so thats why im asking) |
|
Back to top |
|
|
Purge Episode I > Eposide III Jar-Jar is kool
Age:34 Gender: Joined: Sep 08 2004 Posts: 2018 Offline
|
Posted: Tue Apr 01, 2008 4:51 pm Post subject: |
|
|
|
|
I think 50% Packetloss created the rampage that prizes based on sprees. It should be out somewhere, a lot of zones use it.
For flag game stuff, check spawn.cpp in the plugin source file. There should be a flag event somewhere for victories. |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Wed Apr 02, 2008 1:09 am Post subject: |
|
|
|
|
that's pretty much an infinite loop you created there...
It just endlessly checks the conditions. But for the player's bounty to change, other parts of the code have to be executed.
What you want to do is put an 'if' statement that checks your condition everytime the bounty of the player is changed. You can catch that with the PlayerDeath event (the killer's bounty increased) and the PlayerPrize event (player grabbed a green)
Not sure of the exact event names, but you get the idea...
Usually, a while loop will look like:
while (condition)
{
//do stuff
}
You have to make sure that the 'do stuff' part can have an impact on the conditions... Else, you will get an infinite loop if the condition is true. |
|
Back to top |
|
|
Maverick
Age:39 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Wed Apr 02, 2008 1:16 am Post subject: |
|
|
|
|
hellzlaker wrote: | is there a source code the rampage.dll or any one sprees? |
Rampage 2.5 and Rampage 3.0 (with customizable spree messages) is available to download from mervbot.com.
Both plugins have source code included. _________________
|
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: Wed Apr 02, 2008 8:52 pm Post subject: |
|
|
|
|
your model of how you think mervbot execution occurs is wrong. There is only one thread of execution that handles sending and receiving packets, updating the player bounty when appropriate, and running your code. If your loop runs until the bounty is changed, the bot will never get a chance to update the player bounty (as execution is stuck looping in your function waiting for it to change) or send/receive packets (which is why it disconnects, by the way).
Even if the player types .abortmission at some point, the bot can't receive that packet since it's again, looping in your function. |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Thu Apr 03, 2008 4:17 pm Post subject: |
|
|
|
|
ok but will i be able to do something like this
if player type !mission do the following:
wait until player collects 30 bounty and then say you beated the mission
or if player types !abortmission it cancells the "mission"
from what i think its impossible to do without a loop |
|
Back to top |
|
|
Samapico No, these DO NOT look like penises, ok?
Joined: May 08 2003 Posts: 1252 Offline
|
Posted: Thu Apr 03, 2008 4:55 pm Post subject: |
|
|
|
|
You have to think of it like this...
if a player types !mission, set a tag on him that indicates he typed it
//Tag of index 0 is for the Mission value
set_tag(p, 0, 1); |
and with !abortmission, you can simply reset the tag to 0.
In the events where the player's bounty changes (playerdeath, playerprize), get the tag, if it's set to 1, check if he collected 30.
Actually, you could set the tag to the player's current bounty, so you would know what bounty he had when he typed !mission, if you want the mission to stop when he gets 30 bounty more. Might have a problem if it is possible to have a bounty of 0 though... You'd need to use 2 tags, one that just says if he's on a mission or not, and another that tells his bounty when he got on mission.
Have fun.
On a side note, these lines:
c->check("abortmission");
p->bounty; |
Don't do anything... p->bounty only returns the player's bounty. It doesn't update it or whatever. The bot has to receive a packet before modifying that value.
c->check("commandname") only returns true or false depending if the current command fits or not the command you want. Then again, the function doesn't do anything.
You can always right-click on a function, and Go To Definition to see what a function does. If it only returns you something, it's useless to use it in a loop like that. And as Bak said, most loops are useless anyway. |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Thu Apr 03, 2008 8:45 pm Post subject: |
|
|
|
|
thanks samapico this helped allot ,nice quick tutorial |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Fri Apr 04, 2008 5:48 pm Post subject: |
|
|
|
|
shit i got confused with all this, how does a tag exactly work? like is exactly index and data?
(Player *p, int index, int data)
and what do you mean by get the tag? like ?[/code] |
|
Back to top |
|
|
Purge Episode I > Eposide III Jar-Jar is kool
Age:34 Gender: Joined: Sep 08 2004 Posts: 2018 Offline
|
Posted: Fri Apr 04, 2008 6:34 pm Post subject: |
|
|
|
|
Tags pretty much just mark a player for reference using an integer "int data" as defined by the "int index".
To set a tag, you have to use the set_tag(Player *p, int index, int data) function. To read/get a tag you have to use the get_tag(Player *p, int index) function, where you will be checking for "int data".
Example - Setting a tag when a player calls command !sneeze checking if they have not triggered the command beforehand:
spawn.h:
#define INDEX 2 // This is your "int index". Call it whatever you want.
|
command.cpp
if (c->check("sneeze"))
{
if (get_tag(p, INDEX) != 1) // This checks to see if '1' isn't stored for this player, meaning he didn't call !sneeze before.
set_tag(p, INDEX, 1); // This will set the player's tag to '1', meaning he is calling !sneeze for the first time.
}
|
To clear all tags from a player, use the function killTags(Player *p). |
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
|
Back to top |
|
|
|