Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Pk weapons
- for snow by newguy
- this goes in map.cpp in Map::AttackPK
- under if (character_ptr->hp < 0)
- I havent gotten to compile it so there maybe errors
- You also need to add a pk_config file in world.cpp and world.hpp for this to work
- This is used to load the items and chances
- */
- int item[10];int dchance[10]
- for (int i = 0; i < static_cast<int>(this->server->world->pk_config["DropAmount"]);i++)
- {
- item[i] = static_cast<int>(this->server->world->pk_config[util::to_string(i+1) + ".item"]);
- dchance[i] = static_cast<int>(this->server->world->pk_config[util::to_string(i+1) + ".chance"]);
- }
- //actually checking the chance
- for (int i = 0; i < static_cast<int>(this->server->world->pk_config["DropAmount"]); i++)
- {
- int number = util::rand(1,100);
- //Checking if they got the item
- if (dchance[i] >= number)
- {
- //adding the item
- from->AddItem(item[i], 1);
- PacketBuilder builder;
- builder.SetID(PACKET_ITEM, PACKET_GET);
- builder.AddShort(0);
- builder.AddShort(item[i]);
- builder.AddThree(1);
- builder.AddChar(this->player->character->weight);
- builder.AddChar(this->player->character->maxweight);
- from->player->client->SendBuilder(builder);
- //the reason break is here, is so people wont get like 5 items from one kill.
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement