Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

Bounty Talk.cpp

if ((command.length() >= 6 && command.compare(0,6,"bounty") == 0 && arguments.size() >=1))
                {
                        Character *victim = this->server->world->GetCharacter(arguments[0]);
                        if (victim) {
                        int amount = util::to_int(arguments[1]);
                        if (amount) {
                        if (victim->bounty > 0) { this->player->character->ServerMsg("This player already has a bounty on them");}
                        if (this->player->character->HasItem(1) < amount) {this->player->character->ServerMsg("You do not have enough money");}
                        if (amount <= 0) { this->player->character->ServerMsg("Invalid Amount");}
                        else {
                            if (victim->bounty == 0 && this->player->character->HasItem(1) >= amount)
                            {


                                victim->bounty = amount;
                                this->server->world->ServerMsg(this->player->character->name + (" has placed a bounty on ") + victim->name + (" for ") + util::to_string(amount) + (" coins!"));
                                this->player->character->DelItem(1,amount);
                                reply.SetID(PACKET_ITEM, PACKET_JUNK);
                                reply.AddShort(1);
                                reply.AddThree(amount);
                                reply.AddInt(this->player->character->HasItem(1));
                                reply.AddChar(this->player->character->weight);
                                reply.AddChar(this->player->character->maxweight);
                                CLIENT_SEND(reply);

                            }

                        }

                    }
                        }