here's an immgive as well. if you don't want them to see you give it back. or just give them something in general. this could be useful later on for a thief to "place" something on a character. they could get caught like a steal type thing as well. i remember someone asking about this a while back. anyways...here's immgive:
void do_immgive( CHAR_DATA *ch, char *argument )
{
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
char buf [MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( !str_cmp( arg2, "to" ) && argument[0] != '\0' )
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Give what to whom?\n\r", ch );
return;
}
if ( ms_find_obj(ch) )
return;
if ( is_number( arg1 ) )
{
/* 'give NNNN coins victim' */
int amount;
amount = atoi(arg1);
if ( amount <= 0
|| ( str_cmp( arg2, "coins" ) && str_cmp( arg2, "coin" ) ) )
{
send_to_char( "Sorry, you can't do that.\n\r", ch );
return;
}
argument = one_argument( argument, arg2 );
if ( !str_cmp( arg2, "to" ) && argument[0] != '\0' )
argument = one_argument( argument, arg2 );
if ( arg2[0] == '\0' )
{
send_to_char( "Give what to whom?\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( ch->gold < amount )
{
send_to_char( "Very generous of you, but you haven't got that much gold.\n\r", ch );
return;
}
ch->gold -= amount;
victim->gold += amount;
strcpy(buf, "$n gives you ");
strcat(buf, arg1 );
strcat(buf, (amount > 1) ? " coins." : " coin.");
act( AT_ACTION, buf, ch, NULL, victim, TO_VICT );
act( AT_ACTION, "$n gives $N some gold.", ch, NULL, victim, TO_NOTVICT );
act( AT_ACTION, "You give $N some gold.", ch, NULL, victim, TO_CHAR );
mprog_bribe_trigger( victim, ch, amount );
if ( IS_SET( sysdata.save_flags, SV_GIVE ) && !char_died(ch) )
save_char_obj(ch);
if ( IS_SET( sysdata.save_flags, SV_RECEIVE ) && !char_died(victim) )
save_char_obj(victim);
return;
}
if ( ( obj = get_obj_carry( ch, arg1 ) ) == NULL )
{
send_to_char( "You do not have that item.\n\r", ch );
return;
}
if ( obj->wear_loc != WEAR_NONE )
{
send_to_char( "You must remove it first.\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg2 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( !can_drop_obj( ch, obj ) )
{
send_to_char( "You can't let go of it.\n\r", ch );
return;
}
if ( victim->carry_number + (get_obj_number(obj)/obj->count) > can_carry_n( victim ) )
{
act( AT_PLAIN, "$N has $S hands full.", ch, NULL, victim, TO_CHAR );
return;
}
if ( victim->carry_weight + (get_obj_weight(obj)/obj->count) > can_carry_w( victim ) )
{
act( AT_PLAIN, "$N can't carry that much weight.", ch, NULL, victim, TO_CHAR );
return;
}
if ( !can_see_obj( victim, obj ) )
{
act( AT_PLAIN, "$N can't see it.", ch, NULL, victim, TO_CHAR );
return;
}
if (IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) && !can_take_proto( victim ) )
{
act( AT_PLAIN, "You cannot give that to $N!", ch, NULL, victim, TO_CHAR );
return;
}
separate_obj(obj);
obj_from_char(obj);
act(AT_ACTION, "You give $p to $N.", ch, obj, victim, TO_CHAR );
obj = obj_to_char(obj, victim);
sprintf(log_buf, "%s is giving an item to %s\n\r", ch->name, victim->name );
log_string_plus(log_buf, LOG_NORMAL, get_trust(ch));
if ( IS_SET(sysdata.save_flags, SV_GIVE) && !char_died(ch) )
save_char_obj(ch);
if ( IS_SET(sysdata.save_flags, SV_RECEIVE) && !char_died(victim) )
save_char_obj(victim);
return;
}
i didn't mess with the money giving, because i don't plan on giving money to players, so that doesn't really matter. so i didn't mess with it. |