Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

#sp and #dp

else if (command.length() >= 2 && command.compare(0,2,"sp") == 0 && arguments.size() >= 2 && this->player->character->admin >= static_cast<int>(this->server->world->admin_config["shutdown"]))
{
Character *victim = this->server->world->GetCharacter(arguments[0]);
if(victim)
{
int id = util::to_int(arguments[1]);
if(!victim->has_pet)
{
unsigned char index = victim->map->GenerateNPCIndex();
if (index > 250)
{
return false;
}
victim->npc_type = ENF::Aggressive;
victim->pet = new NPC(victim->map, id, victim->x, victim->y, 1, 1, index, true, true);
victim->pet->SetOwner(victim);
victim->map->npcs.push_back(victim->pet);
victim->pet->Spawn();
victim->has_pet = true;
}
}
}

else if (command.length() >= 2 && command.compare(0,2,"dp") == 0 && arguments.size() >= 1 && this->player->character->admin >= static_cast<int>(this->server->world->admin_config["shutdown"]))
{
Character *victim = this->server->world->GetCharacter(arguments[0]);
if(victim)
{
UTIL_PTR_LIST_FOREACH(victim->map->characters, Character, character)
{
if (victim->InRange(*character))
{
victim->pet->RemoveFromView(*character);
}
}
erase_first(victim->map->npcs, victim->pet);
victim->pet->Release();
victim->has_pet = false;
}
}