diff options
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r-- | src/map/charcommand.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 71323ace1..bde5e7d2e 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -907,6 +907,54 @@ int charcommand_zeny(const int fd, struct map_session_data* sd, const char* comm } /*========================================== + * #cash or #points <amount> <charname> + *------------------------------------------*/ +int charcommand_cash(const int fd, struct map_session_data* sd, const char* command, const char* message) +{ + struct map_session_data *pl_sd; + char character[NAME_LENGTH]; + int value = 0; + nullpo_retr(-1, sd); + + memset(character, '\0', sizeof(character)); + + if( !message || !*message || sscanf(message, "%d %23[^\n]", &value, character) < 2 || value == 0 ) + { + clif_displaymessage(fd, "Please, enter a number and a player name (usage: #cash|#points <points> <name>)."); + return -1; + } + + if( (pl_sd = map_nick2sd(character)) != NULL ) + { + if( !strcmpi(command+1,"cash") ) + { + if( value > 0 ) + pc_getcash(pl_sd, value, 0); + else + pc_paycash(pl_sd, value, 0); + + clif_displaymessage(fd, "Character's Cash Points changed!."); + } + else + { // @points + if( value > 0 ) + pc_getcash(pl_sd, 0, value); + else + pc_paycash(pl_sd, value, value); + + clif_displaymessage(fd, "Character's Kafra Points changed!."); + } + } + else + { + clif_displaymessage(fd, msg_txt(3)); // Character not found. + return -1; + } + + return 0; +} + +/*========================================== * #fakename <char name> <fake name> *------------------------------------------*/ int charcommand_fakename(const int fd, struct map_session_data* sd, const char* command, const char* message) @@ -3739,6 +3787,8 @@ CharCommandInfo charcommand_info[] = { { "homfriendly", 60, charcommand_homfriendly }, { "homhungry", 60, charcommand_homhungry }, { "hominfo", 40, charcommand_hominfo }, + { "cash", 60, charcommand_cash }, + { "points", 60, charcommand_cash }, }; |