Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Snippet In Progress

Snippet In Progress

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zelse_007   (9 posts)  Bio
Date Tue 23 Apr 2002 01:48 AM (UTC)
Message
My mud has (or will have)
about 30-40% sci-fi in it, and as such 3 of my builders wish for gun support, I hacked this together (I can read C and do some basic things with it) and I was wondering if anyone could see any glaring mistakes, and where I could send it for more hel(SML mayhaps?)?
void do_shoot( CHAR_DATA *ch, char *argument )
OBJ_DATA *gun, *clip;
int dmg;
int shots;
int ammo_left;
int ammo;
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];

one_argument( argument, arg1); /* Declare Arguments */
one_argument( argument, arg2 );
if( arg1[0] == '\0' || !str_cmp(argument, " ") )
{
send_to_char( "Fire what at who?\n\r", ch );
return;
}
if( !IS_PKILL(ch) && !IS_IMMORTAL(ch) )
{
send_to_char( "Trying to shoot someone?!\n", ch );
send_to_char( "And you call yourself a pacifist. Tsk. Tsk. Tsk.\n", ch );
return;
}
if( (gun=get_eq_char(ch, WEAR_WIELD)) == NULL
|| (gun=get_eq_char(ch, WEAR_WIELD)) !== GUN_SHOTGUN)
{
send_to_char( "You dont have anything wielded!\n\r", ch );
return;
}
if( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
{
set_char_color( AT_MAGIC, ch );
send_to_char( "A non dectatable force jams your gun...\n\r", ch );
return;
}
if( arg2[0] == !str_cmp(arg1, " ") )
send_to_char( "Please specify the gun after wielding it.\n\r", ch );
return;
}
if( !str_cmp(arg2, "shotgun") /* Example Entry */
&& get_eq_char(ch, WEAR_HOLD)) != GUN_SHOTGUN_AMMO
&& GUN_SHOTGUN_AMMO->pIndexData->value[0] > 0 );
gun = GUN_SHOTGUN; /* VNUM Defined in mud.h */
clip = GUN_SHOTGUN_CLIP; /* VNUM Defined in mud.h */
recoil = gun->value[1];
shots = gun->value[0];
ammo_left = clip->value[0];
dmg = 1d5+5
AT_BLOOD( "$n fires his shotgun at $N!\n", ch, NULL, NULL, TO_ROOM );
AT_BLOOD( "You shoot $N with your shotgun!\n", ch, NULL, NULL, TO_CHAR );
AT_BLOOD( "$n shoots you with a shotgun!\n", ch, NULL, NULL, TO_VICT );
return damage( ch, victim, dam, sn );
wait_state(ch, 10);
for ( ammo = clip->pIndexData->value[0] - shots )
{
if( clip->pIndexData->value[0] == 0 )
{
send_to_char( "Your shotgun shell set falls out of the barrell and vanishes...\n\r", ch );
remove_obj(clip);
break;
}
}
}
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


7,521 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.