Author |
Message |
gilder Novice
Age:35 Gender: Joined: Sep 02 2006 Posts: 35 Location: Finland Offline
|
Posted: Mon Sep 04, 2006 9:08 am Post subject: Problem with "Adding Commands" module. |
|
|
|
|
I started studying module writing two days ago with Dev-C++ 4.9.9.2 (Windows XP Pro).
I copied "Adding commands" code from:
http://wiki.minegoboom.com/index.php/Writing_Modules_In_C#Adding_Commands
The module doesn't say anything when i type ?getplayers, but ?help getplayers will show the help text properly. Can you help me? |
|
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 Sep 04, 2006 9:48 am Post subject: |
|
|
|
|
You need to add either cmd_getplayers or privcmd_getplayers (or both, depending on what you're donig) to one of the files in conf/groupdef.dir/ so the zone knows who's allowed to use it. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
gilder Novice
Age:35 Gender: Joined: Sep 02 2006 Posts: 35 Location: Finland Offline
|
Posted: Mon Sep 04, 2006 9:58 am Post subject: |
|
|
|
|
Thanks. Didn't read those instructions well... _________________ Hockey Zone |
|
Back to top |
|
|
gilder Novice
Age:35 Gender: Joined: Sep 02 2006 Posts: 35 Location: Finland Offline
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Tue Sep 05, 2006 7:46 am Post subject: |
|
|
|
|
Sounds like you're not passing the correct struct to it. Check the PlaceBall prototype in balls.h (I'm too lazy). |
|
Back to top |
|
|
gilder Novice
Age:35 Gender: Joined: Sep 02 2006 Posts: 35 Location: Finland Offline
|
|
Back to top |
|
|
i88gerbils Oldbie Server Help
Gender: Joined: Dec 13 2002 Posts: 423 Location: OH Offline
|
Posted: Tue Sep 05, 2006 10:00 am Post subject: |
|
|
|
|
Don't you have to pass the pointer directly and not the value? _________________ Oldbie Server Help |
|
Back to top |
|
|
gilder Novice
Age:35 Gender: Joined: Sep 02 2006 Posts: 35 Location: Finland Offline
|
Posted: Tue Sep 05, 2006 2:29 pm Post subject: |
|
|
|
|
Now the server started crashing.
After a few test times i noticed the following:
ArenaBallData* data;
data->balls->x=512*16;
data->balls->y=512*16;
data->balls->xspeed=0;
data->balls->yspeed=0;
data->balls->carrier=NULL;
data->balls->freq=0;
data->balls->time=0;
data->balls->state=BALL_ONMAP;
balls->PlaceBall(p->arena, 1, data->balls);
|
The ball will be warped, you can see the ball only in big radar (Alt) and server crashes after few seconds.
ArenaBallData* data;
data->balls->x=512*16;
data->balls->y=512*16;
data->balls->xspeed=0;
data->balls->yspeed=0;
data->balls->carrier=NULL;
data->balls->freq=0;
data->balls->time=0;
data->balls->state=BALL_ONMAP;
|
Server crashes
ArenaBallData* data;
data->balls->x=512*16;
data->balls->y=512*16;
data->balls->xspeed=0;
data->balls->yspeed=0;
data->balls->carrier=NULL;
data->balls->freq=0;
data->balls->time=0;
|
nothing happends
ArenaBallData* data;
data->balls->x=512*16;
data->balls->y=512*16;
data->balls->xspeed=0;
data->balls->yspeed=0;
data->balls->carrier=NULL;
data->balls->freq=0;
data->balls->time=0;
balls->PlaceBall(p->arena, 1, data->balls);
|
nothing happends
"data->balls->state=BALL_ONMAP;" seems to crash the zone. |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Tue Sep 05, 2006 2:32 pm Post subject: |
|
|
|
|
Number one, you are overriding memory. ArenaBallData's balls is a pointer to struct Balls and not a memory space in itself. So you are clobbering data with that. Try this instead:
struct BallData data;
data.state=BALL_ONMAP;
data.x=512;
data.y=512;
data.xspeed=0;
data.yspeed=0;
data.carrier=NULL;
data.freq=1;
data.time=0;
balls->PlaceBall(p->arena, 1, &data); |
If you really wanted to use ArenaBallData for this:
ArenaBallData data;
data.balls = (struct Balls*)amalloc(sizeof(struct Balls));
data.balls->state=BALL_ONMAP;
data.balls->x=512;
data.balls->y=512;
data.balls->xspeed=0;
data.balls->yspeed=0;
data.balls->carrier=NULL;
data.balls->freq=1;
data.balls->time=0;
balls->PlaceBall(p->arena, 1, data.balls);
afree(data.balls); |
|
|
Back to top |
|
|
|