Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[REQUEST]help me in this code

Опубликовано:

hello every 1

this is alive players code

it works

but the problem is that it show team 1:players and team2: players in place of friends: players and ennemys: players

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {


           PlayerConnected += new Action(entity =>
           {



               HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.6f);
               LabelA.SetPoint("DOWNRIGHT", "DOWNRIGHT", -5, 130);
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.6f);
               LabelB.SetPoint("DOWNRIGHT", "DOWNRIGHT", -5, 110);
               LabelB.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   aliveteam = Call("getteamplayersalive", "allies");
                   aliveenemy = Call("getteamplayersalive", "axis");
                   LabelA.SetText("^2Friendly ^7: ^5" + aliveteam.ToString());
                   LabelB.SetText("^1Enemy ^7 : ^5" + aliveenemy.ToString());
                   return true;
               });
           });


       }




   }
}

Featured Replies

Опубликовано:

fix your bloody english

also, you create a BaseScript OnInterval for every client joined - optimize pls

also, you might want to have the text change depending on the clients team

Опубликовано:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {			
	HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("TEAM A");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("TEAM B");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   LabelANum.SetText(Call("getteamplayersalive", "allies").ToString());
                   LabelBNum.SetText(Call("getteamplayersalive", "axis").ToString());
                   return true;
               });
           });
       }
   }
}

Try not to mix variables with static text in HudElem classes... screws it up.

Опубликовано:
  • Автор
fix your bloody english

also, you create a BaseScript OnInterval for every client joined - optimize pls

also, you might want to have the text change depending on the clients team

yea thats what i want

can u do it?

Опубликовано:
  • Автор
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {			
	HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("TEAM A");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("TEAM B");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   LabelANum.SetText(Call("getteamplayersalive", "allies").ToString());
                   LabelBNum.SetText(Call("getteamplayersalive", "axis").ToString());
                   return true;
               });
           });
       }
   }
}

Try not to mix variables with static text in HudElem classes... screws it up.

 

same problem with ur code

it show ennemys in place of friends

the text have to change depending on the clients team

Опубликовано:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {			
	HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("TEAM A");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("TEAM B");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   LabelANum.SetText(Call("getteamplayersalive", "allies").ToString());
                   LabelBNum.SetText(Call("getteamplayersalive", "axis").ToString());
                   return true;
               });
           });
       }
   }
}

Try not to mix variables with static text in HudElem classes... screws it up.

 

same problem with ur code

it show ennemys in place of friends

the text have to change depending on the clients team

So you wan't it to only show the number of players of the team that the player is currently on?

Опубликовано:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {			
	HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("TEAM A");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("TEAM B");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   LabelANum.SetText(Call("getteamplayersalive", "allies").ToString());
                   LabelBNum.SetText(Call("getteamplayersalive", "axis").ToString());
                   return true;
               });
           });
       }
   }
}

Try not to mix variables with static text in HudElem classes... screws it up.

 

same problem with ur code

it show ennemys in place of friends

the text have to change depending on the clients team

So you wan't it to only show the number of players of the team that the player is currently on?

 

if that's the case you should check on which team the player is before showing the specific HudElem.

This can be done with

player.GetField("sessionteam");

Опубликовано:

What he wants:

 

ex. on Allies there are 6players alive and on Axis there are 4players alive.

If you are Allies, your hud shows:

Friendly: 6

Enemies: 4

If you are Axis, your hud shows:

Friendly: 4

Enemies: 6

Get it?

Опубликовано:
What he wants:

 

ex. on Allies there are 6players alive and on Axis there are 4players alive.

If you are Allies, your hud shows:

Friendly: 6

Enemies: 4

If you are Axis, your hud shows:

Friendly: 4

Enemies: 6

Get it?

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public int aliveteam;
       public int aliveenemy;
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {         
			HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("Friendlies");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("Enemies ");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

			string axis = Call("getteamplayersalive", "axis").ToString();
			string allies = Call("getteamplayersalive", "allies").ToString();
			string sessionteam = entitiy.GetField("sessionteam");

               OnInterval(50, () =>
               {
                   LabelANum.SetText((sessionteam=="allies")?allies:axis);
                   LabelBNum.SetText((sessionteam=="allies")?axis:allies);
                   return true;
               });
           });
       }
   }
}

 

Communication is a beautiful thing when it works....

Опубликовано:
  • Автор

guys script is wrong

it doesnt count players alive wtf

after adding

  string sessionteam = entitiy.GetField("sessionteam");

               OnInterval(50, () =>
               {
                   LabelANum.SetText((sessionteam=="allies")?allies:axis);
                   LabelBNum.SetText((sessionteam=="allies")?axis:allies);
                   return true;

Опубликовано:
guys script is wrong

it doesnt count players alive wtf

after adding

  string sessionteam = entitiy.GetField("sessionteam");

               OnInterval(50, () =>
               {
                   LabelANum.SetText((sessionteam=="allies")?allies:axis);
                   LabelBNum.SetText((sessionteam=="allies")?axis:allies);
                   return true;

Please for the love of God learn some C# before complaining to us.

Опубликовано:

Fucking.... third time.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {
               HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("FRIENDLY");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("ENEMY");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   string sessionteam = entity.GetField("sessionteam");
                   string axis = Call("getteamplayersalive", "axis").ToString();
                   string allies = Call("getteamplayersalive", "allies").ToString();
                   LabelANum.SetText((sessionteam.Equals("allies")) ? allies : axis);
                   LabelBNum.SetText((sessionteam.Equals("allies")) ? axis : allies);
                   return true;
               });
           });
       }
   }
}

You deal with the alignment

Опубликовано:
  • Автор
Fucking.... third time.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfinityScript;
using System.Timers;

namespace Alive_Players
{
   public class Alive : BaseScript
   {
       public Alive()
       {
           PlayerConnected += new Action(entity =>
           {
               HudElem LabelA = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelA.SetPoint("TOPLEFT", "TOPLEFT", 30, 110);
               LabelA.SetText("FRIENDLY");
               LabelA.HideWhenInMenu = true;

               HudElem LabelB = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelB.SetPoint("TOPLEFT", "TOPLEFT", 30, 130);
               LabelB.SetText("ENEMY");
               LabelB.HideWhenInMenu = true;

               HudElem LabelANum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelANum.SetPoint("TOPLEFT", "TOPLEFT", 110, 110);
               LabelANum.HideWhenInMenu = true;

               HudElem LabelBNum = HudElem.CreateFontString(entity, "hudbig", 0.8f);
               LabelBNum.SetPoint("TOPLEFT", "TOPLEFT", 110, 130);
               LabelBNum.HideWhenInMenu = true;

               OnInterval(50, () =>
               {
                   string sessionteam = entity.GetField("sessionteam");
                   string axis = Call("getteamplayersalive", "axis").ToString();
                   string allies = Call("getteamplayersalive", "allies").ToString();
                   LabelANum.SetText((sessionteam.Equals("allies")) ? allies : axis);
                   LabelBNum.SetText((sessionteam.Equals("allies")) ? axis : allies);
                   return true;
               });
           });
       }
   }
}

You deal with the alignment

 

in this code it depends with player team but it counts only friendly -__-

Опубликовано:

Did you even try it with other players/bots before complaining, because it works completely fine for me.

If you wanted something different then you should have asked for it differently in the first post.

Опубликовано:
  • Автор

i tried it with friends

when i change side it work for friend good

but it doesnt show any number in ennemy case

Опубликовано:
i tried it with friends

when i change side it work for friend good

but it doesnt show any number in ennemy case

You could be descriptive on which side is not working you ------------------. Say which side it's working for AXIS or ALLIES

Опубликовано:

DO YOU EVEN READ?

                    LabelANum.SetText((sessionteam.Equals("allies")) ? allies : axis);
                   LabelBNum.SetText((sessionteam.Equals("allies")) ? axis : allies);

they're both ALLIES. Change either one of those to axis (mainly labelb).

Опубликовано:
DO YOU EVEN READ?

                    LabelANum.SetText((sessionteam.Equals("allies")) ? allies : axis);
                   LabelBNum.SetText((sessionteam.Equals("allies")) ? axis : allies);

they're both ALLIES. Change either one of those to axis (mainly labelb).

Its supposed to be like that.... do YOU even read?

 

This is it expanded into if statements

if(sessionteam.Equals("allies")) {
LabelANum.SetText(allies);
LabelBNum.SetText(axis);
} else {
LabelANum.SetText(axis);
LabelBNum.SetText(allies);
}

 

And can you please lock this now because the OP's problem has been solved but he keeps complaining it isn't right.

Гость
Эта тема закрыта для публикации сообщений.

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.