Jump to content

Question

2 answers to this question

Recommended Posts

  • 0
Posted

add this to src/custom/atcommand.inc
 

ACMD_FUNC(gcash)
{
	map_session_data* tsd = nullptr;
	int amount = 0, ret = 0;
	char output[CHAT_SIZE_MAX];
	nullpo_retr(-1,sd);

	memset(atcmd_output, '\0', sizeof(atcmd_output));

	if( sd->state.cashshop_open ){
		clif_displaymessage(fd, msg_txt(sd, 1376)); // Please close the cashshop before using this command.
		return -1;
	}

	if (!message || !*message || sscanf(message, "%11d %23[^\n]", &amount, atcmd_player_name) < 2) {
		clif_displaymessage(fd, "Invalid value (@gcash <amount> <character name>");
		return -1;
	}
	
	if ((tsd = map_nick2sd(atcmd_player_name,false)) == NULL) {
		clif_displaymessage(fd, msg_txt(sd,3)); // Character not found.
		return -1;
	}

	if (sd->cashPoints < amount || amount < 0) {
        clif_displaymessage(fd, "Not enough Cash Points.");
        return -1;
    }
    
	if( (ret=pc_paycash(sd, amount, 0, LOG_TYPE_COMMAND)) >= 0)
	{
		sprintf(output, msg_txt(sd,410), ret, sd->cashPoints); // Removed %d cash points. Total %d points.
		clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF);
	}
		
	if( (ret=pc_getcash(tsd, amount, 0, LOG_TYPE_COMMAND)) >= 0)
	{
		sprintf(output, msg_txt(sd,505), ret, tsd->cashPoints); // Gained %d cash points. Total %d points.
		clif_messagecolor(&tsd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF);
	}

	sprintf(output, "%d players has received '%s'",atcmd_player_name,amount);
	atcommand_broadcast( fd, sd, "@broadcast", output);

    return 0;
}

this to src/custom/atcommand_def.inc


ACMD_DEF(gcash),

this to conf/msg_conf/map_msg.conf

410: Removed %d cash points. Total %d points.
505: Gained %d cash points. Total %d points.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...