Перейти к содержимому
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.
Опубликовано:

i dont know why the people who make the mods or script's are so jealous when someone ask for the source code , some people dont understand the logic of who to code something.. so here's the code for the message's on screen

 

i dont know who i should give the credits, so the credits go to the community, i guess :)

 

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

namespace messageS
{
   public class messageS : BaseScript
   {
       private HudElem info;
       public messageS()
           : base()
       {

           PlayerConnected += new Action(entity =>
           {
               info = HudElem.CreateServerFontString("hudbig", 0.6f);//TYPE AND FONT SIZE
               info.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, 1);//COORDINATES AND LOCATION:CENTER, LEFT, RIGHT, TOP, BOTTOM
               info.HideWhenInMenu = true;
               info.SetText("^1M^2E^3S^4S^5A^6G^7E");//HERE'S WHERE THE MESSAGE GO


           });
       }
   }
}

 

Picture

Featured Replies

Опубликовано:
MPRO":19dywkh2]Thanks nice mod :)

but can u please show me example how to add another message ? sorry im noob in programming :D

i made 1 msg it worked ^^

easy just skip a space and start from info = again

 

playerConnected += new Action(entity =>
           {
               info = HudElem.CreateServerFontString("hudbig", 1.2f);//TYPE AND FONT SIZE
               info.SetPoint("TOPCENTER", "TOPCENTER", 0, 1);//COORDINATES AND LOCATION:CENTER, LEFT, RIGHT, TOP, BOTTOM
               info.HideWhenInMenu = true;
               info.SetText("^5message one");//HERE'S WHERE THE MESSAGE GO

                info = HudElem.CreateServerFontString("hudbig", 1.0f);//TYPE AND FONT SIZE
               info.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, 1);//COORDINATES AND LOCATION:CENTER, LEFT, RIGHT, TOP, BOTTOM
               info.HideWhenInMenu = true;
               info.SetText("^5 message 2");//HERE'S WHERE THE MESSAGE GO

               info = HudElem.CreateServerFontString("hudbig", 0.6f);//TYPE AND FONT SIZE
               info.SetPoint("TOPRIGHT", "TOPRIGHT", 0, 1);//COORDINATES AND LOCATION:CENTER, LEFT, RIGHT, TOP, BOTTOM
               info.HideWhenInMenu = true;
               info.SetText("by: ^5 message 3");//HERE'S WHERE THE MESSAGE GO

  • 2 weeks later...
  • 4 months later...
Опубликовано:

IВґm using the following script for random weapons on my server.

I want to print the remaining time for the next weapon swich in the HUD.

How do I do thath?

 

 public RandomWeapon_1()
           : base()
       {
           _switchTime = Call("getDvarInt", "shrp_switchTime", 90);
           _cycleRemaining = _switchTime;
           PrepareWeaponLists();

           _currentWeapon = GetRandomWeapon();
           OnInterval(1000, () =>
           {
               _cycleRemaining -= 1;

               if (_cycleRemaining == 0)
               {
                   _cycleRemaining = _switchTime;
               }
               return true;
           });


           OnInterval(_switchTime * 1000, () =>
           {
               _currentWeapon = GetRandomWeapon();
               _cycleRemaining = _switchTime;

               foreach (var player in Players)
               {

                   if (player.IsAlive && player.GetField("sessionteam") == "allies")
                   {
                       player.TakeWeapon(player.CurrentWeapon);
                       player.GiveWeapon(_currentWeapon);
                       // player.Call("giveMaxAmmo", _currentWeapon);

                       player.AfterDelay(100, ent =>
                       {
                           ent.SwitchToWeaponImmediate(_currentWeapon);
                       });
                   }
               }

               return true;
           });

           //PlayerConnected += new Action(entity =>
           //{

           //    entity.SpawnedPlayer += new Action(() =>
           //    {


           //        if (entity.GetField("sessionteam") == "axis")

           //            entity.TakeWeapon(entity.CurrentWeapon);

           //    });

           //});
       }
       private string GetRealWeaponName(string weapon)
       {
           var tokens = weapon.Split('_');

           if (tokens[0] == "iw5")
           {
               return tokens[1];
           }
           else
           {
               return tokens[0];
           }
       }
       private string FormatTime(int seconds)
       {
           return string.Format("{0}:{1}", seconds / 60, (seconds % 60).ToString().PadLeft(2, '0'));
       }
       private void PrepareWeaponLists()
       {
           _weaponList = new[]
           {
               "iw5_m4",
               "iw5_m16",
               "iw5_scar",
               "iw5_cm901",
               "iw5_type95",
               "iw5_g36c",
               "iw5_acr",
               "iw5_mk14",
               "iw5_ak47",
               "iw5_fad",
               "iw5_mp5",
               "iw5_ump45",
               "iw5_pp90m1",
               "iw5_p90",
               "iw5_m9",
             "iw5_mp7",
               "iw5_sa80",
               "iw5_mg36",
               "iw5_pecheneg",
               "iw5_mk46",
               "iw5_m60",

           };
           _validAttachments = new Dictionary();
           foreach (var weapon in _weaponList)
           {
               var attachments = new List();

               for (int column = 11; column <= 21; column++)
               {
                   var attachment = Call("tableLookup", "mp/statstable.csv", 4, weapon, column);

                   if (attachment != "")
                   {
                       attachments.Add(attachment);

                   }
               }

               _validAttachments.Add(weapon, attachments.ToArray());

           }
       }
       private string GetRandomWeapon()
       {
           var weapon = (from w in _weaponList
                         where !_usedWeapons.Contains(w)
                         orderby _rng.Next()
                         select w).FirstOrDefault();

           if (weapon == null)
           {
               _usedWeapons.Clear();

               weapon = _weaponList[_rng.Next(0, _weaponList.Length)];
           }

           _usedWeapons.Add(weapon);

           return AddRandomAttachmentToWeapon(weapon);
       }
       private string[] GetDesiredAttachments()
       {
           var attachmentTypes = new[]
           {
               "none",
               "sight",
               "sight",
               "sight",
               "sight",
               "sight",
               "other",
               "other",
               "other",
               "final"
           };

           switch (attachmentTypes[_rng.Next(0, attachmentTypes.Length)])
           {
               case "none":
                   return new string[0];
               case "sight":
                   return new[]
                   {
                       "acog",
                       "reflex",
                       "hamrhybrid",
                       "hybrid",
                       "zoomscope",
                       "eotech",
                       "vzscope"
                   };
               case "other":
                   return new[]
                   {
                       "silencer",
                       "silencer02",
                       "silencer03",
                       "grip",
                       "gl",
                       "gp25",
                       "m320",
                       "shotgun",
                       //"akimbo"
                   };
               case "final":
                   return new[]
                   {
                       "thermal",
                       "heartbeat"
                   };
           }

           return new string[0];
       }
       private string AddRandomAttachmentToWeapon(string baseWeapon)
       {
           var attachmentList = _validAttachments[baseWeapon];

           if (attachmentList.Length == 0)
           {
               return Utilities.BuildWeaponName(baseWeapon, "none", "none", _rng.Next(0, 14), _rng.Next(0, 7));

           }

           var validDesireList = false;
           string[] desiredAttachments = null;

           while (!validDesireList)
           {
               desiredAttachments = GetDesiredAttachments();

               if (desiredAttachments.Length == 0)
               {
                   return Utilities.BuildWeaponName(baseWeapon, "none", "none", _rng.Next(0, 14), _rng.Next(0, 7));
               }

               foreach (var attachment in desiredAttachments)
               {
                   if (attachmentList.Contains(attachment))
                   {
                       validDesireList = true;
                       break;
                   }
               }
           }

           string usedAttachment = "none";
           var validAttachment = false;

           while (!validAttachment)
           {
               usedAttachment = desiredAttachments[_rng.Next(0, desiredAttachments.Length)];

               if (attachmentList.Contains(usedAttachment))
               {
                   validAttachment = true;
               }
           }
           Log.Write(LogLevel.Trace, "weapon {0}", baseWeapon);
           return Utilities.BuildWeaponName(baseWeapon, usedAttachment, "none", _rng.Next(0, 14), _rng.Next(0, 7));
       }
   }
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 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.