|
Luigi Auriemmaaluigi.org (ARCHIVE-ONLY FORUM!) |
|
It is currently 19 Jul 2012 14:44
|
View unanswered posts | View active topics
Author |
Message |
evan1715
|
Post subject: Q3: JK2: Source code help Posted: 27 Oct 2007 01:40 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
ok if you are trying to add like a timer between things what would u use? for the JK2 source code on http://jediknight3.filefront.com/file/J ... Tools;2888 like say if u want to put a pause between a command and a message shows up that says "You can only change models every second" instead of a flood that can do it 1 milisecond, so basically i want it to be anti flood so they can only change models every 1 second, and it cant flood if its that slow, what kind of counter code would i put?
Last edited by evan1715 on 04 Nov 2007 02:32, edited 1 time in total.
|
|
Top |
|
|
|
|
|
|
|
aluigi
|
Post subject: Posted: 27 Oct 2007 12:56 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
You can insert a time check like that used in rcon, the following is the code just from that check:
unsigned int time;
static unsigned int lasttime = 0;
time = Com_Milliseconds();
if ( (unsigned)( time - lasttime ) < 500u ) {
return;
}
lasttime = time;
substituite 500u with 1000u and naturally place the instruction in the right function which handles the models
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 16:03 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
argh
Last edited by evan1715 on 25 Nov 2007 18:53, edited 1 time in total.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 18:15 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:01, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 27 Oct 2007 18:24 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
yes, seems right.
unsigned is used in the quake3 code
Check if the function you are modifying is void otherwise you must return something (like NULL or zero and so on)
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 18:33 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:01, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 27 Oct 2007 19:32 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
I think that the function you must check is ClientUserinfoChanged
For the moment try to add the piece of time code just at its beginning and check if works then you can continue with the optimizations.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 20:24 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:02, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 27 Oct 2007 20:42 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
you could subsituite it with another function.
For example time(NULL) returns the time in seconds which is also a good choice, remember only to substituite 1000u with 1
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 21:13 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:01, edited 1 time in total.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 27 Oct 2007 21:38 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:02, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 28 Oct 2007 13:01 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
seems you have placed the instructions in the wrong place, try at line 1134
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 15:17 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:02, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 28 Oct 2007 16:22 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
oh shit, time and time() that's the problem ih ih ih
rename time (the var, NOT time(NULL)) as timez and it will work.
If you continue to have problems with "unsingned" after this change substituite it with uint or uint32_t or just leave int alone.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 16:28 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:03, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 28 Oct 2007 16:33 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
unsigned int timez;
static unsigned int lasttime = 0;
timez = time(NULL);
if ( (unsigned)( timez - lasttime ) < 1 ) return;
lasttime = timez;
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 16:35 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:03, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 28 Oct 2007 16:50 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
try to add #include <time.h> at the beginning of the file (not the function, just the entire file), if this doesn't work there is a function called FloatTime that you can use but you must use float values instead of unsigned int
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 16:55 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:03, edited 1 time in total.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 17:12 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:06, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 28 Oct 2007 17:18 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
float timez;
static float lasttime = 0;
timez = FloatTime();
if ( ( timez - lasttime ) < 1.0 ) return;
lasttime = timez;
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 28 Oct 2007 17:21 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:03, edited 1 time in total.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 30 Oct 2007 01:03 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:04, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 30 Oct 2007 15:06 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
you should check the source code of the mod searching for a function which gives you the time in milliseconds or seconds.
The Quake 3 engine uses FloatTime and Com_Milliseconds, for the other implementations of the engine (mods) I don't know.
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 04 Nov 2007 02:33 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:04, edited 1 time in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 04 Nov 2007 12:55 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
search "protocol" (" included) in the source code and find when it's checked.
If you don't find it search PROTOCOL_VERSION and modify it as that of 1.02
|
|
Top |
|
|
Some Guy Named Dave
|
Post subject: Posted: 04 Nov 2007 19:08 |
|
Joined: 24 Oct 2007 00:44 Posts: 26
|
I don't think Protocol is on the source, but rather the exe? Because I can't find it in the source.
Edit:
Yea I see it in the exe.
print.Server uses protocol version %i
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 04 Nov 2007 20:11 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:04, edited 2 times in total.
|
|
Top |
|
|
aluigi
|
Post subject: Posted: 04 Nov 2007 20:50 |
|
Joined: 13 Aug 2007 21:44 Posts: 4068 Location: http://aluigi.org
|
In that case you need only to modify the executable which is an easy job.
For example take a look to the following assembly from the 1.02 executable for Windows where the needed protocol is 15 (0x0000000f in hex):
Code: * Possible StringData Ref from Data Obj ->"protocol" | :00426EC9 68D4334700 push 004733D4 :00426ECE 51 push ecx :00426ECF E81CC2FEFF call 004130F0 :00426ED4 50 push eax :00426ED5 E8C13F0300 call 0045AE9B :00426EDA 8BD8 mov ebx, eax :00426EDC 83C418 add esp, 00000018 :00426EDF 83FB0F cmp ebx, 0000000F :00426EE2 743A je 00426F1E :00426EE4 6A0F push 0000000F
* Possible StringData Ref from Data Obj ->"print Server uses protocol version " ->"%i. " | :00426EE6 68AC334700 push 004733AC
|
|
Top |
|
|
evan1715
|
Post subject: Posted: 04 Nov 2007 21:34 |
|
Joined: 05 Oct 2007 01:20 Posts: 402 Location: Florida
|
blarg
Last edited by evan1715 on 21 Jan 2008 19:05, edited 1 time in total.
|
|
Top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|