//=========GUNGAME_MODE_V_1.0========//
//============BY_ARMADYL5============//
//===============ENJOY===============//


// Feel Free To Use Any Script Or Method You Like //


private const bool MELEE_DISABLED = true;  // set to false to Enable Melee Weapons .
private const bool THROWABLES_DISABLED = true;  // set to false to Enable Throwables . (Grenades/Mines/Molotovs)


int Time = 0;
int BazookaPlayers = 0;


public void OnStartup(){
Time = 15;
Game.ShowPopupMessage("Time Left For The Gun Cycle : " + Time.ToString() , Color.Red);
IObject[] Obj = Game.GetObjectsByName(new string[]{
"SpawnWeaponArea", "SpawnWeaponAreaCeiling"});
foreach(IObject Object in Obj){
Object.Remove();
}
IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer.SetIntervalTime(100);
Timer.SetRepeatCount(0);
Timer.SetScriptMethod("GunGameRules");
Timer.Trigger();
IObjectTimerTrigger Timer0 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer0.SetIntervalTime(1000);
Timer0.SetRepeatCount(0);
Timer0.SetScriptMethod("GunGameTimer");
Timer0.Trigger();
foreach(IPlayer ply in Game.GetPlayers()){
Vector2 Here = ply.GetWorldPosition();
Game.PlayEffect("CFTXT",Here,"GunGame Mode Activated");
ply.GiveWeaponItem(WeaponItem.PISTOL);
}
}



//============(SCRIPT)============//



public void GunGameRules(TriggerArgs args){
if(!Game.IsGameOver){
foreach(IPlayer ply in Game.GetPlayers()){
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
}
if(MELEE_DISABLED){
ply.RemoveWeaponItemType(WeaponItemType.Melee);
}
if(THROWABLES_DISABLED){
ply.RemoveWeaponItemType(WeaponItemType.Thrown);
}
BazookaPlayers = 0;
if((ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.BAZOOKA){
BazookaPlayers ++;
if(BazookaPlayers == 1){
Game.SetGameOver(ply.Name.ToString() + " Wins !");
Game.ShowPopupMessage("Game Ended", Color.Red);
}
if(BazookaPlayers > 1){
foreach(IPlayer ply0 in Game.GetPlayers()){
if((ply0.CurrentPrimaryWeapon).WeaponItem != WeaponItem.BAZOOKA){
ply0.Gib();
}
}
}
}
}
}
}



public void GunGameTimer(TriggerArgs args){
if(!Game.IsGameOver){
if(Time == 1){
Time = 15;
Game.ShowPopupMessage("Time Left For The Gun Cycle : " + Time.ToString() , Color.Red);
foreach(IPlayer ply in Game.GetPlayers()){
if(!ply.IsDead){
if(ply.CurrentWeaponDrawn != WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem != WeaponItem.NONE || ply.CurrentWeaponDrawn != WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem != WeaponItem.NONE){
Vector2 Here = ply.GetWorldPosition();
Game.PlayEffect("CFTXT",Here,"Draw a Weapon !");
}
if((ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.NONE && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.NONE){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.PISTOL);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.PISTOL){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.REVOLVER);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.REVOLVER){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.UZI);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.UZI){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.FLAREGUN);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.FLAREGUN){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.MAGNUM);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Handgun && (ply.CurrentSecondaryWeapon).WeaponItem == WeaponItem.MAGNUM){
ply.RemoveWeaponItemType(WeaponItemType.Handgun);
ply.GiveWeaponItem(WeaponItem.CARBINE);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.CARBINE){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.SMG);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.SMG){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.SHOTGUN);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.SHOTGUN){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.TOMMYGUN);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.TOMMYGUN){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.SNIPER);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.SNIPER){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.ASSAULT);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.ASSAULT){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.FLAMETHROWER);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.FLAMETHROWER){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.M60);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.M60){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.GRENADE_LAUNCHER);
}
if(ply.CurrentWeaponDrawn == WeaponItemType.Rifle && (ply.CurrentPrimaryWeapon).WeaponItem == WeaponItem.GRENADE_LAUNCHER){
ply.RemoveWeaponItemType(WeaponItemType.Rifle);
ply.GiveWeaponItem(WeaponItem.BAZOOKA);
}
}
if(ply.IsDead && ply.IsUser){
Vector2 Here = ply.GetWorldPosition();
IPlayer ply0 = Game.CreatePlayer(Here);
ply0.SetUser(ply.GetUser());
ply0.SetProfile(ply.GetProfile());
ply0.SetTeam(ply.GetTeam());
ply0.GiveWeaponItem(WeaponItem.PISTOL);
ply.Remove();
}
}
}
if(Time > 0){
Time --;
}
Game.ShowPopupMessage("Time Left For The Gun Cycle : " + Time.ToString() , Color.Red);
}
}



//============(SCRIPT)============//



// Thanks For Playing ! Please Enjoy . :)