Need Help For A/D Server

Started by W3aPoN^, Dec 13, 2016, 10:47 AM

Previous topic - Next topic

W3aPoN^

How to Make marker at Defense base in A/D Server i already tried this
     CreateMarker(player.UniqueWorld, Vector( -1734, -715, 5.8680 ), 5, RGB(0, 0, 0), 26 );
but when base changes all markers appears i only want that spouse base 1 is started then marker only appear at base 1's defense position is base 2 start then marker appears at base 2's defenders position hope understand :P thankuu inn advance i know i am IDIOT, Stupid :D

DizzasTeR

So you just visited my server and now you want to make an A/D server

Trust me nobody got time to sit here and code a properly working A/D gamemode for you. Download the public script and use it as many others do or code a proper one yourself and ask for help when you get stuck.

W3aPoN^

I am Stucked Server is Ready and I Bought The Server at $300PKr And The Script is Working Now Just This Little Marker Problem is Appeared

Xmair

Store the marker in a variable, use DestroyMarker( var ) to delete it. Repeat the process.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

W3aPoN^

Not Working i Already Tried

Xmair

Quote from: =NK=RazaCharan** on Dec 13, 2016, 11:34 AMNot Working i Already Tried
You never tried.
// Put this in your base starting function.

local
iMarker = CreateMarker( ... );

// And this in your base ending function.

DestroyMarker( iMarker );

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

W3aPoN^


See The Code Brother its Not Working :(

===========================================================================
===========================================================================
function LoadBases()
{
  local i = 0;
  while (i < 35)
  {
    local q = QuerySQL( db, "SELECT cp,def,att,name FROM Bases WHERE ID=" + i );
    Bases = BaseClass();
    local p = i.tostring();
    Bases.CP = GetSQLColumnData(q,0);
    Bases.DefenseSpawn = GetSQLColumnData(q,1);
    Bases.AttackSpawn = GetSQLColumnData(q,2);
    Bases.Name = GetSQLColumnData(q,3);
    i++;
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function LoadPickups()
{
  local i = 0;
  while (i < 35)
  {
    local x = (GetTok( Bases.CP, ",", 1)).tofloat(),
        y = (GetTok( Bases.CP, ",", 2)).tofloat(),
          z = (GetTok( Bases.CP, ",", 3)).tofloat();
    CreatePickup(382, Vector(x, y, z));
    i++;
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function StartRound(base2)
{
local
 iMarker = CreateMarker( ... );
  base2 = base2.tointeger();
  CurrentBase = base2;
  RoundActive = true;
  MinRemain = 10;
  SecRemain = 0;
  local i = 0, p = GetPlayers();
  local attx = (GetTok(Bases[base2].AttackSpawn, ",", 1)).tofloat(), atty = (GetTok(Bases[base2].AttackSpawn, ",", 2)).tofloat(), attz = (GetTok(Bases

[base2].AttackSpawn, ",", 3)).tofloat();
  local defx = (GetTok(Bases[base2].DefenseSpawn, ",", 1)).tofloat(), defy = (GetTok(Bases[base2].DefenseSpawn, ",", 2)).tofloat(), defz = (GetTok(Bases

[base2].DefenseSpawn, ",", 3)).tofloat();
  while (i <= p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      if ((plr.IsSpawned) && (pinfo.Side != "Ref"))
      {
        GiveWeapons(plr, 0);
        plr.Health = 100;
        plr.Armour = 100;
        plr.IsFrozen = true;
        pinfo[plr.ID].InSetChoice = true;
        local num = RandNum(1,5);
        if (pinfo.Side == "Att")
        {
          AttackerCount++;
          plr.Pos = Vector( attx + num, atty + num, attz);
          PrivMessage(plr,"Attacking base: " + Bases[base2].Name);

        }
        else if (pinfo.Side == "Def")
        {
          DefenderCount++;
          plr.Pos = Vector( defx + num, defy + num, defz);
          PrivMessage(plr,"Defending base: " + Bases[base2].Name);

        }
        ClientMessage("-> [#7fffd4]You have been added to the round, do /set to choose a set. Default set = 0", plr, 255,0,102);
        ClientMessage("-> [#7fffd4]Do /setlist to see the setlist.", plr, 255,0,102);
        pinfo.InRound = true;
      }

    }
    i++;
  }
  commencetimer <- NewTimer("Commence", 10000, 1);
  CurrentCP.x = (GetTok(Bases[base2].CP, ",", 1)).tofloat();
  CurrentCP.y = (GetTok(Bases[base2].CP, ",", 2)).tofloat();
  CurrentCP.z = (GetTok(Bases[base2].CP, ",", 3)).tofloat();
  ClientMessageToAll("-> [#ccff00]Base Started: " + Bases[base2].Name, 255,0,102);
  UpdateTimer.Start();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function RoundUpdate()
{
  AttHp = 0;
  DefHp = 0;
  if (RoundActive == false)
  {
    UpdateTimer.Stop();
    local i = 0, p = GetPlayers();
    while (i <= p)
    {
      local plr = FindPlayer(i);
      if (plr)
      {
        if (plr.IsSpawned) Announce("~b~Swat ~x~VS ~r~Terrorists", plr, 3);
      }
      i++;
    }
    return;
  }
  if (Paused == true) return;
  SecRemain--;
  if(SecRemain < 0)
    {
        SecRemain = 59;
      MinRemain--;
      if(MinRemain < 0)
      {
      ClientMessageToAll("-> Base time exceeded",255,0,102);
        EndRound(1);
        return;
      }
    }
  if(PlayerInCP != -1)
    {
        if(IsPlayerInCP(PlayerInCP) == true)
        {
      CPCount--;
      if(CPCount == 0)
      {
          EndRound(3);
        CPCount = 20;
          return;
         }
      }
      else
      {
      PlayerInCP = -1;
      CPCount = 20;
      }
    }

  local i = 0, p = GetPlayers(), aalive = 0, dalive = 0;
  while (i <= p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      if (pinfo.InRound)
      {
        if (pinfo.Side == "Att")
        {
          aalive++;
          AttHp += plr.Health;
          AttHp += plr.Armour;
          plr.Score = (plr.Health + plr.Armour);
          if (PlayerInCP == -1)
          {
            if (IsPlayerInCP(i))
            {
              PlayerInCP = i;
            }
          }

        }
        else if (pinfo.Side == "Def")
        {
          dalive++;
          DefHp += plr.Health;
          DefHp += plr.Armour;
          plr.Score = (plr.Health + plr.Armour);

        }
      }
    }
    i++;
  }

  local y = 0, h = GetPlayers();
  while (y <= h)
  {
    local plr = FindPlayer(y);
    if (plr)
    {
      if (plr.IsSpawned)
      {
        if (PlayerInCP == -1)
        {
          if (SecRemain > 9)
          {
            Announce("~b~" + MinRemain + ":" + SecRemain, plr, 5);
          }
          else Announce("~b~" + MinRemain + ":0" + SecRemain, plr, 5);
        }
        else Announce("~y~ " + CPCount, plr, 5);
      }
    }
    y++;
  }
  if ((aalive < 1) || dalive < 1) Debug();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function EndRound(reason)
{
  try{
  PlayerInCP = -1;
  RoundActive = false;
  CurrentBase = -1;
  MinRemain = 10;
  SecRemain = 0;
  RespawnVehicles;
  AnnounceAll( "\x10 \x10",5 );
  local i = 0, p = GetPlayers(), mScore = 0, mName;
  while (i <=p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      pinfo.WepSet = 0;
      if (pinfo.InRound == true) plr.Pos = Vector(-1754.2418 + RandNum(1,5),-155.7444 + RandNum(1,5),14.8683);
      if (pinfo.RKills > mScore) { mScore = pinfo.RKills; mName = plr.Name; }
      pinfo.RKills = 0;
      if ((AutoSwap) && (reason != 4))
      {
        if (pinfo.Side == "Att") pinfo.Side = "Def";
        else if (pinfo.Side == "Def") pinfo.Side = "Att";
      }
      plr.Health = 100;
      plr.Armour = 100;
      plr.Disarm();
    }
    i++;
  }
  if (reason == 1)
  {
    if (Swap){ AnnounceAll("~b~Defenders Win.", 3); BlueScore++; }
    else { AnnounceAll("~r~Attackers Win.", 3); RedScore++; }
  }
  else if (reason == 2)
  {
    if (Swap) {  AnnounceAll("~r~Attackers Win.", 3); RedScore++; }
    else { AnnounceAll("~b~Defenders Win.", 3); BlueScore++; }
  }
  else if (reason == 3)
  {
    if (Swap) {  AnnounceAll("~b~Defenders Took The Checkpoint.", 3); BlueScore++; }
    else { AnnounceAll("~r~Attackers Took The Checkpoint.", 3); RedScore++; }
  }
  else if (reason == 4) return;

  if (mName) ClientMessageToAll("-> [#ffffff]Top Scorer: " + mName + " (" + mScore + ")", 255,0,102);
  if (AutoSwap)
  {
    ClientMessageToAll("-> [#ffff00]Teams Have Swapped.", 255,0,102);
    if (Swap) { Swap = false; ClientMessageToAll("-> [#ffff00]Terrorists Are Now Attacking.", 255,0,102); }
    else { Swap = true; ClientMessageToAll("-> [#ffff00]Terrorists are Now Defending.", 255,0,102); }
  }
  ClientMessageToAll("-> [#ffffff]Current Score - [#ff0000]Terrorists: " + RedScore + " [#0080ff]Swat: " + BlueScore, 255,0,102);
  BlueSetLim = [0,0,0,0,0,0,0];
  RedSetLim = [0,0,0,0,0,0,0];
  }catch(e) print("Endround error: " + e);
DestroyMarker( iMarker );
}

Cool

Use  tags or no one will understand

Xmair

function LoadBases()
{
  local i = 0;
  while (i < 35)
  {
    local q = QuerySQL( db, "SELECT cp,def,att,name FROM Bases WHERE ID=" + i );
    Bases = BaseClass();
    local p = i.tostring();
    Bases.CP = GetSQLColumnData(q,0);
    Bases.DefenseSpawn = GetSQLColumnData(q,1);
    Bases.AttackSpawn = GetSQLColumnData(q,2);
    Bases.Name = GetSQLColumnData(q,3);
    i++;
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function LoadPickups()
{
  local i = 0;
  while (i < 35)
  {
    local x = (GetTok( Bases.CP, ",", 1)).tofloat(),
        y = (GetTok( Bases.CP, ",", 2)).tofloat(),
          z = (GetTok( Bases.CP, ",", 3)).tofloat();
    CreatePickup(382, Vector(x, y, z));
    i++;
  }
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local
iMarker;
function StartRound(base2)
{

  base2 = base2.tointeger();
  CurrentBase = base2;
  RoundActive = true;
  MinRemain = 10;
  SecRemain = 0;
  local i = 0, p = GetPlayers();
  local attx = (GetTok(Bases[base2].AttackSpawn, ",", 1)).tofloat(), atty = (GetTok(Bases[base2].AttackSpawn, ",", 2)).tofloat(), attz = (GetTok(Bases

[base2].AttackSpawn, ",", 3)).tofloat();
  local defx = (GetTok(Bases[base2].DefenseSpawn, ",", 1)).tofloat(), defy = (GetTok(Bases[base2].DefenseSpawn, ",", 2)).tofloat(), defz = (GetTok(Bases

[base2].DefenseSpawn, ",", 3)).tofloat();
iMarker = CreateMarker( 1, Vector( attx, atty, attz ), 5, RGB( 255, 255, 0 ), 0 );
  while (i <= p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      if ((plr.IsSpawned) && (pinfo.Side != "Ref"))
      {
        GiveWeapons(plr, 0);
        plr.Health = 100;
        plr.Armour = 100;
        plr.IsFrozen = true;
        pinfo[plr.ID].InSetChoice = true;
        local num = RandNum(1,5);
        if (pinfo.Side == "Att")
        {
          AttackerCount++;
          plr.Pos = Vector( attx + num, atty + num, attz);
          PrivMessage(plr,"Attacking base: " + Bases[base2].Name);

        }
        else if (pinfo.Side == "Def")
        {
          DefenderCount++;
          plr.Pos = Vector( defx + num, defy + num, defz);
          PrivMessage(plr,"Defending base: " + Bases[base2].Name);

        }
        ClientMessage("-> [#7fffd4]You have been added to the round, do /set to choose a set. Default set = 0", plr, 255,0,102);
        ClientMessage("-> [#7fffd4]Do /setlist to see the setlist.", plr, 255,0,102);
        pinfo.InRound = true;
      }

    }
    i++;
  }
  commencetimer <- NewTimer("Commence", 10000, 1);
  CurrentCP.x = (GetTok(Bases[base2].CP, ",", 1)).tofloat();
  CurrentCP.y = (GetTok(Bases[base2].CP, ",", 2)).tofloat();
  CurrentCP.z = (GetTok(Bases[base2].CP, ",", 3)).tofloat();
  ClientMessageToAll("-> [#ccff00]Base Started: " + Bases[base2].Name, 255,0,102);
  UpdateTimer.Start();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function RoundUpdate()
{
  AttHp = 0;
  DefHp = 0;
  if (RoundActive == false)
  {
    UpdateTimer.Stop();
    local i = 0, p = GetPlayers();
    while (i <= p)
    {
      local plr = FindPlayer(i);
      if (plr)
      {
        if (plr.IsSpawned) Announce("~b~Swat ~x~VS ~r~Terrorists", plr, 3);
      }
      i++;
    }
    return;
  }
  if (Paused == true) return;
  SecRemain--;
  if(SecRemain < 0)
    {
        SecRemain = 59;
      MinRemain--;
      if(MinRemain < 0)
      {
      ClientMessageToAll("-> Base time exceeded",255,0,102);
        EndRound(1);
        return;
      }
    }
  if(PlayerInCP != -1)
    {
        if(IsPlayerInCP(PlayerInCP) == true)
        {
      CPCount--;
      if(CPCount == 0)
      {
          EndRound(3);
        CPCount = 20;
          return;
         }
      }
      else
      {
      PlayerInCP = -1;
      CPCount = 20;
      }
    }

  local i = 0, p = GetPlayers(), aalive = 0, dalive = 0;
  while (i <= p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      if (pinfo.InRound)
      {
        if (pinfo.Side == "Att")
        {
          aalive++;
          AttHp += plr.Health;
          AttHp += plr.Armour;
          plr.Score = (plr.Health + plr.Armour);
          if (PlayerInCP == -1)
          {
            if (IsPlayerInCP(i))
            {
              PlayerInCP = i;
            }
          }

        }
        else if (pinfo.Side == "Def")
        {
          dalive++;
          DefHp += plr.Health;
          DefHp += plr.Armour;
          plr.Score = (plr.Health + plr.Armour);

        }
      }
    }
    i++;
  }

  local y = 0, h = GetPlayers();
  while (y <= h)
  {
    local plr = FindPlayer(y);
    if (plr)
    {
      if (plr.IsSpawned)
      {
        if (PlayerInCP == -1)
        {
          if (SecRemain > 9)
          {
            Announce("~b~" + MinRemain + ":" + SecRemain, plr, 5);
          }
          else Announce("~b~" + MinRemain + ":0" + SecRemain, plr, 5);
        }
        else Announce("~y~ " + CPCount, plr, 5);
      }
    }
    y++;
  }
  if ((aalive < 1) || dalive < 1) Debug();
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function EndRound(reason)
{
  try{
  PlayerInCP = -1;
  RoundActive = false;
  CurrentBase = -1;
  MinRemain = 10;
  SecRemain = 0;
  RespawnVehicles;
  AnnounceAll( "\x10 \x10",5 );
  local i = 0, p = GetPlayers(), mScore = 0, mName;
  while (i <=p)
  {
    local plr = FindPlayer(i);
    if (plr)
    {
      pinfo.WepSet = 0;
      if (pinfo.InRound == true) plr.Pos = Vector(-1754.2418 + RandNum(1,5),-155.7444 + RandNum(1,5),14.8683);
      if (pinfo.RKills > mScore) { mScore = pinfo.RKills; mName = plr.Name; }
      pinfo.RKills = 0;
      if ((AutoSwap) && (reason != 4))
      {
        if (pinfo.Side == "Att") pinfo.Side = "Def";
        else if (pinfo.Side == "Def") pinfo.Side = "Att";
      }
      plr.Health = 100;
      plr.Armour = 100;
      plr.Disarm();
    }
    i++;
  }
  if (reason == 1)
  {
    if (Swap){ AnnounceAll("~b~Defenders Win.", 3); BlueScore++; }
    else { AnnounceAll("~r~Attackers Win.", 3); RedScore++; }
  }
  else if (reason == 2)
  {
    if (Swap) {  AnnounceAll("~r~Attackers Win.", 3); RedScore++; }
    else { AnnounceAll("~b~Defenders Win.", 3); BlueScore++; }
  }
  else if (reason == 3)
  {
    if (Swap) {  AnnounceAll("~b~Defenders Took The Checkpoint.", 3); BlueScore++; }
    else { AnnounceAll("~r~Attackers Took The Checkpoint.", 3); RedScore++; }
  }
  else if (reason == 4) return;

  if (mName) ClientMessageToAll("-> [#ffffff]Top Scorer: " + mName + " (" + mScore + ")", 255,0,102);
  if (AutoSwap)
  {
    ClientMessageToAll("-> [#ffff00]Teams Have Swapped.", 255,0,102);
    if (Swap) { Swap = false; ClientMessageToAll("-> [#ffff00]Terrorists Are Now Attacking.", 255,0,102); }
    else { Swap = true; ClientMessageToAll("-> [#ffff00]Terrorists are Now Defending.", 255,0,102); }
  }
  ClientMessageToAll("-> [#ffffff]Current Score - [#ff0000]Terrorists: " + RedScore + " [#0080ff]Swat: " + BlueScore, 255,0,102);
  BlueSetLim = [0,0,0,0,0,0,0];
  RedSetLim = [0,0,0,0,0,0,0];
  }catch(e) print("Endround error: " + e);
DestroyMarker( iMarker );
}

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

W3aPoN^


Xmair

Because of local attx = (GetTok(Bases[base2].AttackSpawn, ",", 1)).tofloat(), atty = (GetTok(Bases[base2].AttackSpawn, ",", 2)).tofloat(), attz = (GetTok(Bases

[base2].AttackSpawn, ",", 3)).tofloat();
  local defx = (GetTok(Bases[base2].DefenseSpawn, ",", 1)).tofloat(), defy = (GetTok(Bases[base2].DefenseSpawn, ",", 2)).tofloat(), defz = (GetTok(Bases

[base2].DefenseSpawn, ",", 3)).tofloat();
and seriously?local q = QuerySQL( db, "SELECT cp,def,att,name FROM Bases WHERE ID=" + i );
    Bases = BaseClass();
    local p = i.tostring();
    Bases.CP = GetSQLColumnData(q,0);
    Bases.DefenseSpawn = GetSQLColumnData(q,1);
    Bases.AttackSpawn = GetSQLColumnData(q,2);
    Bases.Name = GetSQLColumnData(q,3);
    i++;

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Finch Real

Quote from: Doom_Kill3R on Dec 13, 2016, 11:20 AMSo you just visited my server and now you want to make an A/D server

Trust me nobody got time to sit here and code a properly working A/D gamemode for you. Download the public script and use it as many others do or code a proper one yourself and ask for help when you get stuck.
Agree with Doom! :D
My Snipet Showroom

http://pastebin.com/5KKuU5cg

=RK=MarineForce

#12
NOT WORKING

Round Start base

Add full " but not working @Xmair
Try to UnderStand ME!

=RK=MarineForce

Add This On Main.NUT A/D Server @Xmair

https://ufile.io/8akym Script LINK " Add This On ScRIPT

But i can't add it Errror Showing XDDDDDDD
Try to UnderStand ME!