Arena System

Started by MRSK143, Jun 23, 2021, 07:48 AM

Previous topic - Next topic

MRSK143

Hi Guyz I Made A Simple Arena System


Add This Into Class

DeathInArena = false;
Add This Into onScriptLoad

DeathInArena <- array( GetMaxPlayers(), null );
PlayerInArena <-array(GetMaxPlayers(),0);
ArenaPermit <-array(GetMaxPlayers(),0);
arenawall1 <- CreateObject(310,1,Vector(-1342.81, 1289.21, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.0000000000),1);
arenawall2 <- CreateObject(310,1,Vector(-1351.61, 1306.81, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.0000000000),1);
arenawall3 <- CreateObject(310,1,Vector(-1342.81, 1306.81, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.0000000000),1);
arenawall4 <- CreateObject(310,1,Vector(-1351.71, 1306.71, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.7071063121),1);
arenawall5 <- CreateObject(310,1,Vector(-1334.01, 1297.91, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.7071063121),1);
arenawall6 <- CreateObject(310,1,Vector(-1351.71, 1297.91, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.7071063121),1);
arenawall7 <- CreateObject(310,1,Vector(-1351.61, 1289.21, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.0000000000),1);
arenawall8 <- CreateObject(310,1,Vector(-1334.08, 1306.67, 83.043),255).RotateToEuler(Vector(0.0000000000, 0.0000000000, 0.7071063121),1);

Add This Into onPlayerJoin

ArenaPermit[player.ID] = 0;
PlayerInArena[player.ID] = 0;
DeathInArena[player.ID] = 0;
arena1.World = 2;
arena2.World = 2;
arena3.World = 2;
arena4.World = 2;
arena5.World = 2;
arena6.World = 2;
arena7.World = 2;
arena8.World = 2;

Add This Into onPlayerDeath

if ( status[ player.ID ].DeathInArena )
{
DeathInArena[ player.ID ] = player.Pos;
}

Add This Into onPlayerSpawn

if ( status[ player.ID ].DeathInArena )
{
player.Pos = DeathInArena[ player.ID ];
}

Here The CMD That Admin Would BE Able To Start Arena Event
Add This Into onPlayerCommand

else if ( cmd == "arena" )
{
if( Admin[ player.ID ] == true )
{
if (!text)
{
if ( text == "on" )
{
if( ArenaPermit[ player.ID ] == true )
{
ArenaPermit[ player.ID ] = true;
Message( "[#FFbb00] Admin " + player.Name + " Has Started Arena Event.);
}
else MessagePlayer("[#db0000]Arena Event IS Already Started.", player);
}
else if ( text == "off" )
{
if( ArenaPermit[ player.ID ] == false )
{
ArenaPermit[ player.ID ] = false;
for(local i = 0; i < GetMaxPlayers(); ++i)
local plr = GetPlayer(i)
if( PlayerInArena[ plr.ID ] == true )
plr.Pos = Vector( -1341.79 1334.71 103.043 );
Message( "[#FFbb00] Admin " + player.Name + " Has Stopped Arena Event.);
}
else MessagePlayer("[#db0000]Arena Event IS Already Closed.", player);
}
}
else MessagePlayer("Syntax; /arena <on/off>.", player);
}
else MessagePlayer("[#db0000]Unknown command.", player);
}

Warning: You Need To Use My Staff Level System To Use Start Arena CMD
Staff Level System Link:
https://forum.vc-mp.org/?topic=8560.msg51316#msg51316


You Can Only Join The Arena Event When Any Admin Has Started Arena Event
Here The CMD That Normal Player Will Be Able To Join Arena Event
Add This Into onPlayerCommand

else if ( cmd == "joinarena" )
{
for(local i = 0; i < GetMaxPlayers(); ++i)
local plr = GetPlayer(i)
if( ArenaPermit[ plr.ID ] == true )
{
if( PlayerInArena[ player.ID ] == true )
{
PlayerInArena[ player.ID ] = true;
player.World = arenawall1.World;
player.Pos = Vector( -1341.79 1320.71 103.043 );
status[ player.ID ].DeathInArena = true;
Message( "[#FFbb00]** "+player.Name+" Has Joined Arena Event);
}
else MessagePlayer("[#db0000]Unknown command.", player);
}
else MessagePlayer("[#db0000]Unknown command.", player);
}

Here The CMD That Player WIll Be Able TO Leave Arena If The Player Is IN Arena
Add This Into onPlayerCommand

else if ( cmd == "leavearena" )
{
for(local i = 0; i < GetMaxPlayers(); ++i)
local plr = GetPlayer(i)
if( ArenaPermit[ plr.ID ] == true )
{
if( PlayerInArena[ player.ID ] == false )
{
player.Pos = Vector( -1341.79 1334.71 103.043 );
status[ player.ID ].DeathInArena = false;
PlayerInArena[ player.ID ] = false;
player.World = 1;
Message( "[#FFbb00]** "+player.Name+" Has Leaved The Arena Event);
}
else MessagePlayer("[#db0000]You Already Leaved Arena Event.", player);
}
else MessagePlayer("[#db0000]Unknown command.", player);
}

Untested It But It Will Work If You Find A Bug Dont Hesitate To PM On Discord Or Either You Can PM Me Here Also Discord: SK#6304

@mR_Sk@

husnainaligee

Good worked nice worked.