Author |
Message |
JaqMs14 Guest
Offline
|
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Jul 05, 2004 1:44 pm Post subject: |
 |
|
|
|
You never defined setfreq
unsigned int setfreq = 0; // change.
setfreq+=getInteger(c->final,10); _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
|
Back to top |
|
 |
JaqMs14 Guest
Offline
|
Posted: Mon Jul 05, 2004 2:23 pm Post subject: |
 |
|
|
|
Yes I know, it's messy. I copied it from a !setship command and I thought it would do the same thing. |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Mon Jul 05, 2004 2:32 pm Post subject: |
 |
|
|
|
Of course checking if the parameter of the command is a valid freq number (0 <= number && number <= 9999) or something, and making sure the number is not the spectator frequency number could both be useful too.
But that's up to you, heh. |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Jul 05, 2004 4:11 pm Post subject: |
 |
|
|
|
Oh true lol.. i didnt really pay much attention.. oops :/ |
|
Back to top |
|
 |
JaqMs14 Guest
Offline
|
Posted: Mon Jul 05, 2004 4:14 pm Post subject: |
 |
|
|
|
One more question, how do I make it so that the users cannot switch frequencies/ships? I know you can do it by putting code in under case EVENT_PlayerTeam but I want to know if I can just lock it or something. |
|
Back to top |
|
 |
JaqMs14 Guest
Offline
|
Posted: Mon Jul 05, 2004 4:23 pm Post subject: |
 |
|
|
|
Sorry, never mind about that top post. Apperently, I didn't know all the things that *lock did. |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Mon Jul 05, 2004 9:25 pm Post subject: |
 |
|
|
|
Uint16 Freq= getInteger(c->final,10);//you could use this or do it by hand
if(Freq >= 0 && Freq <=9999)
{
char SetMsg[14];
sprintf(SetMsg,"*setfreq %d",Freq);
//then whatever else you want
}
Thing with Strings is that they allocate/deallocate memory everytime they perform a task and they run a bunch of crap code. I used them so i can get bots done quickly, but something small such as the *setfreq command should be put together with the sprintf function |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Tue Jul 06, 2004 10:21 am Post subject: |
 |
|
|
|
Actually, for even more speedy-quickness, you don't have to do a negative check (unsigned). _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Tue Jul 06, 2004 11:40 am Post subject: |
 |
|
|
|
Cyan~Fire wrote: | Actually, for even more speedy-quickness, you don't have to do a negative check (unsigned). |
A problem with this is that others that may read your code may not notice that, and may assume that there is a sign problem. So leaving it in may make it a bit slower, but better readable. Hopefully, a compiler may notice that its checked if an always positive value is positive, and may reduce that instruction for you, but it may not. Those things have been getting very smart these days. |
|
Back to top |
|
 |
|