Flag System

Started by =RK=MarineForce, Sep 21, 2018, 08:42 AM

Previous topic - Next topic

=RK=MarineForce

Updating
You can change Everything, what u wish. :P
Sorry i can't make when player move on Pickup of Flag it will failed to stole it.

[noae]class PlayerStats
{
flag = false;
}
[/noae]
[noae]cflag <- null;
hflag <- null;
[/noae]

[noae]function onScriptLoad()
{
cflag<- CreatePickup(283, Vector( -1187.42, 102.232, 11.1281 ));
hflag<- CreatePickup(382, Vector( -1196.04, 107.397, 11.1279));
Stats <- array(GetMaxPlayers(), null);
print(" Flag System has Been Loaded by Stuko, MarineForce ");
}
[/noae]
[noae]function onPlayerJoin( player )
{
Stats[player.ID] = PlayerStats();
}
[/noae]

[noae]function onPlayerSpawn( player )
{
Stats[player.ID].flag = false;
MessagePlayer(" [#FFFF00] Stats Flag: " + Stats[player.ID].flag + " ",player);
}
[/noae]

[noae]function onPlayerDeath( player, reason )
{
NewTimer( "death", 10, 1, player.ID );
}
[/noae]

[noae]function onPlayerCommand( player, cmd, text )
{
if ( cmd == "flagstats" )
{
if ( Stats[player.ID].flag ) MessagePlayer(" You are At Flag Status ",player);
if ( !Stats[player.ID].flag ) MessagePlayer(" You are Not At Flag Status ",player);
}


if ( cmd == "flag" )
{
if ( text == "on" ){
Stats[player.ID].flag = true;
}
if ( text == "off" ){
Stats[player.ID].flag = false;
}
}
[/noae]

[noae]function onPickupPickedUp( player, pickup )
 {
if( pickup.Model == 382 )
{
 if(player.Team == 2 ) MessagePlayer(" [#0000ff] You can't Stole Your own Flag ",player);
 else{
 NewTimer( "ann1", 1000, 1, player.ID );
  NewTimer( "ann2", 2000, 1, player.ID );
   NewTimer( "ann3", 3000, 1, player.ID );
 NewTimer( "flags", 4000, 1, player.ID );
 }
 }
 if( pickup.Model == 383 )
 {
 if(player.Team == 1 ) MessagePlayer(" [#FFFF00] You can't Stole Your own Flag ",player);
 else{
 NewTimer( "ann1", 1000, 1, player.ID );
  NewTimer( "ann2", 2000, 1, player.ID );
   NewTimer( "ann3", 3000, 1, player.ID );
 NewTimer( "flags", 4000, 1, player.ID );
  }
  }
if( pickup.Model == 343 )
 {
 NewTimer( "storeflag", 1000, 1, player.ID );
 player.PlaySound( 50009 );
  }
}
[/noae]


[noae]function flags(p)
{
    local player = FindPlayer(p);
    if(player)
    {
        if ( player.Team == 1 )
        {
            Message(" [#0000FF] " + player.Name + " Stole The Haitian Flag ");
            cflag.Remove();
Stats[player.ID].flag = true;
        }

        if ( player.Team == 2 )
        {
            Message(" [#0000FF] " + player.Name + " Stole The Cuban Flag ");
   hflag.Remove();
   Stats[player.ID].flag = true;
        }

    }
}
[/noae]
[noae]function storeflag(p)
{
    local player = FindPlayer(p);
    if(player)
    {

        if ( player.Team == 1 )
        {
  if ( Stats[player.ID].flag == false ) MessagePlayer(" [#FFFF00] Go Stole The Haitian Flag ",player);
  else{
           Message("[#FFFF00] [Cuban Team] " + player.Name + " Store The Flag +5 ");
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
   Cuban_Team_Score += 5;
   
        }
}
        if ( player.Team == 2 )
        { 
    if ( Stats[player.ID].flag == false ) MessagePlayer(" [#FFFF00] Go Stole The Haitian Flag ",player);
else{
            Message("[#0000FF][Haitian Team] " + player.Name + " Store The Flag +5 ");
            CreatePickup(382, Vector( -1195.69, 106.684, 11.1279));
Stats[player.ID].flag = false;
Haitian_Team_Score += 5;
}
}
    }
}
[/noae]

[noae]function ann1(p)
{
    local player = FindPlayer(p);
    if(player)
{
Announce( " ~r~-1-", player, 1 );
player.PlaySound( 50009 );
}
}
function ann2(p)
{
local player = FindPlayer(p);
    if(player)
    {
Announce( "~o~-2-", player, 1 );
player.PlaySound( 50009 );
}
}
function ann3(p)
{
local player = FindPlayer(p);
    if(player)
    {
Announce( "~g~-3-", player, 1 );
player.PlaySound( 50009 );
}
}

[code]function death(p)
{
    local player = FindPlayer(p);
    if(player)
    {

        if ( player.Team == 1 )
        {
  if ( Stats[player.ID].flag == true ) Message("[#FFFF00] " + player.Name + " Has Been Killed Cuban Flag Has been Covered.");
  else{
   cflag.Remove();
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
        }
}
        if ( player.Team == 2 )
        { 
     if ( Stats[player.ID].flag == true ) Message("[#FFFF00] " + player.Name + " Has Been Killed Cuban Flag Has been Covered.");
  else{
   cflag.Remove();
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
}
}
    }

}
[/noae]

All in One
[noae]class PlayerStats
{
flag = false;
}

cflag <- null;
hflag <- null;

function onScriptLoad()
{
cflag<- CreatePickup(283, Vector( -1187.42, 102.232, 11.1281 ));
hflag<- CreatePickup(382, Vector( -1196.04, 107.397, 11.1279));
Stats <- array(GetMaxPlayers(), null);
print(" Flag System has Been Loaded by Stuko, MarineForce ");
}

function onPlayerJoin( player )
{
Stats[player.ID] = PlayerStats();
}


function onPlayerSpawn( player )
{
Stats[player.ID].flag = false;
MessagePlayer(" [#FFFF00] Stats Flag: " + Stats[player.ID].flag + " ",player);
}


function onPlayerDeath( player, reason )
{
NewTimer( "death", 10, 1, player.ID );
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "flagstats" )
{
if ( Stats[player.ID].flag ) MessagePlayer(" You are At Flag Status ",player);
if ( !Stats[player.ID].flag ) MessagePlayer(" You are Not At Flag Status ",player);
}


if ( cmd == "flag" )
{
if ( text == "on" ){
Stats[player.ID].flag = true;
}
if ( text == "off" ){
Stats[player.ID].flag = false;
}
}

function onPickupPickedUp( player, pickup )
 {
if( pickup.Model == 382 )
{
 if(player.Team == 2 ) MessagePlayer(" [#0000ff] You can't Stole Your own Flag ",player);
 else{
 NewTimer( "ann1", 1000, 1, player.ID );
  NewTimer( "ann2", 2000, 1, player.ID );
   NewTimer( "ann3", 3000, 1, player.ID );
 NewTimer( "flags", 4000, 1, player.ID );
 }
 }
 if( pickup.Model == 383 )
 {
 if(player.Team == 1 ) MessagePlayer(" [#FFFF00] You can't Stole Your own Flag ",player);
 else{
 NewTimer( "ann1", 1000, 1, player.ID );
  NewTimer( "ann2", 2000, 1, player.ID );
   NewTimer( "ann3", 3000, 1, player.ID );
 NewTimer( "flags", 4000, 1, player.ID );
  }
  }
if( pickup.Model == 343 )
 {
 NewTimer( "storeflag", 1000, 1, player.ID );
 player.PlaySound( 50009 );
  }
}



function flags(p)
{
    local player = FindPlayer(p);
    if(player)
    {
        if ( player.Team == 1 )
        {
            Message(" [#0000FF] " + player.Name + " Stole The Haitian Flag ");
            cflag.Remove();
Stats[player.ID].flag = true;
        }

        if ( player.Team == 2 )
        {
            Message(" [#0000FF] " + player.Name + " Stole The Cuban Flag ");
   hflag.Remove();
   Stats[player.ID].flag = true;
        }

    }
}
function storeflag(p)
{
    local player = FindPlayer(p);
    if(player)
    {

        if ( player.Team == 1 )
        {
  if ( Stats[player.ID].flag == false ) MessagePlayer(" [#FFFF00] Go Stole The Haitian Flag ",player);
  else{
           Message("[#FFFF00] [Cuban Team] " + player.Name + " Store The Flag +5 ");
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
   Cuban_Team_Score += 5;
   
        }
}
        if ( player.Team == 2 )
        { 
    if ( Stats[player.ID].flag == false ) MessagePlayer(" [#FFFF00] Go Stole The Haitian Flag ",player);
else{
            Message("[#0000FF][Haitian Team] " + player.Name + " Store The Flag +5 ");
            CreatePickup(382, Vector( -1195.69, 106.684, 11.1279));
Stats[player.ID].flag = false;
Haitian_Team_Score += 5;
}
}
    }
}


function ann1(p)
{
    local player = FindPlayer(p);
    if(player)
{
Announce( " ~r~-1-", player, 1 );
player.PlaySound( 50009 );
}
}
function ann2(p)
{
local player = FindPlayer(p);
    if(player)
    {
Announce( "~o~-2-", player, 1 );
player.PlaySound( 50009 );
}
}
function ann3(p)
{
local player = FindPlayer(p);
    if(player)
    {
Announce( "~g~-3-", player, 1 );
player.PlaySound( 50009 );
}
}

function death(p)
{
    local player = FindPlayer(p);
    if(player)
    {

        if ( player.Team == 1 )
        {
  if ( Stats[player.ID].flag == true ) Message("[#FFFF00] " + player.Name + " Has Been Killed Cuban Flag Has been Covered.");
  else{
   cflag.Remove();
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
        }
}
        if ( player.Team == 2 )
        { 
     if ( Stats[player.ID].flag == true ) Message("[#FFFF00] " + player.Name + " Has Been Killed Cuban Flag Has been Covered.");
  else{
   cflag.Remove();
           CreatePickup(383, Vector( -1163.68, -620.189, 11.8277 ));
   Stats[player.ID].flag = false;
}
}
    }

}
[/noae]

Download Sound: https://files.fm/u/68gr23ex

Can Some One Plese Make Custom flags for me :(

=RK=MarineForce