PDA

View Full Version : [TrinityCore] GM Security



Wise
20-08-17, 01:52 AM
I do NOT take credit for this script (except sharing)
I found the script somewhere online it had minimal usage so I updated it, you're free to use it.


This script is about :


GM Security destroys all items upon login for game masters (levels 1-3) & automatically equips them with game master gear.




Game Master Security Script:

//Maker: No idea
//Updated

#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "ScriptedGossip.h"
#include "ScriptedCreature.h"
#include "Player.h"
#include "Unit.h"
#include "World.h"
#include "WorldSession.h"


class gamemasters_security : public PlayerScript
{
public:
gamemasters_security() : PlayerScript("gamemasters_security") {}

void OnLogin(Player* player, bool /*firstLogin*/) override
{
// Prevent GMs at all ranks to play as a normal player
if (player->GetSession()->GetSecurity() == 1 || player->GetSession()->GetSecurity() == 2 || player->GetSession()->GetSecurity() == 3)
{
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
for (uint8 slot = INVENTORY_SLOT_BAG_START; slot < INVENTORY_SLOT_BAG_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
for (uint8 slot = BANK_SLOT_ITEM_START; slot < BANK_SLOT_ITEM_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
for (uint8 slot = BANK_SLOT_BAG_START; slot < BANK_SLOT_BAG_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);
for (uint8 slot = BUYBACK_SLOT_START; slot < BUYBACK_SLOT_END; slot++)
player->DestroyItem(INVENTORY_SLOT_BAG_0, slot, true);

player->EquipNewItem(EQUIPMENT_SLOT_CHEST, 2586, true);
player->EquipNewItem(EQUIPMENT_SLOT_FEET, 11508, true);
player->EquipNewItem(EQUIPMENT_SLOT_HEAD, 12064, true);
}
}
};

void AddSC_Security_Scripts()
{
new gamemasters_security;
}