1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 13:47:46 +00:00

Gm invis is less of a hack

This commit is contained in:
Biscuit Boy 2018-04-19 22:47:03 +10:00
parent b401c951a7
commit 3310ee0fe6

View file

@ -226,29 +226,16 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
}
case GmCommand::Invis:
{
if( targetPlayer->getGmInvis() == false ) {
targetPlayer->setGmInvis( true );
auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
player.sendNotice( "Invisibility flag for " + targetPlayer->getName() + " was toggled to on" );
break;
}
else
player.setGmInvis( !player.getGmInvis() );
player.sendNotice( "Invisibility flag for " + player.getName() +
" was toggled to " + std::to_string( !player.getGmInvis() ) );
for( auto actor : player.getInRangeActors() )
{
targetPlayer->setGmInvis( false );
auto inRange = targetPlayer->getInRangeActors();
for( auto actor : inRange )
{
targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() );
}
player.sendNotice( "Invisibility flag for " + targetPlayer->getName() + " was toggled to off" );
break;
player.despawn( actor->getAsPlayer() );
player.spawn( actor->getAsPlayer() );
}
break;
}
case GmCommand::Kill:
{