Перейти к содержимому
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'm trying to make a mod which you can do sorts of funny stuff with chat commands.

but i got a problem when i tried to do some commands like norecoil toggle and infinite equipment ammo toggle.

norecoil just goes away after a few shots and inf equip doest work

heres the code:

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

namespace Ammo
{

   public class Ammo : BaseScript
   {
       public Ammo()
           : base()
       {
           PlayerConnected += new Action(entity =>
           {
               Call("setdvar", "motd", "Lol");
           });
       }
       public override void OnSay(Entity player, string name, string message)
       {
           var offhand = player.Call("getcurrentoffhand");
           var norecoil = false;
           var equipment = false;
           var loop = 1;


           // Ressuply

           if (message.StartsWith("!giveammo"))
           {
               var weapon = player.CurrentWeapon;
               player.Call("giveMaxAmmo", player.CurrentWeapon);
           }
           if (message.StartsWith("!giveoffhand"))
           {
               var weapon = player.CurrentWeapon;
               player.Call("giveMaxAmmo", offhand);
           }

           // Invisibility

           if (message.StartsWith("!invon"))
           {
               player.Call("iprintlnbold", "Invisibility: ON");
               player.Call("hide");
           }
           if (message.StartsWith("!invoff"))
           {
               player.Call("iprintlnbold", "Invisibility: OFF");
               player.Call("show");
           }

           // No Recoil

           if (message.StartsWith("!norecoilon"))
           {
               player.Call("iprintlnbold", "No Recoil: ON");
               norecoil = true;
           }
           if (message.StartsWith("!norecoiloff"))
           {
               player.Call("iprintlnbold", "No Recoil: OFF");
               norecoil = false;
           }

           // Infinite Equipment

           if (message.StartsWith("!equipon"))
           {
               player.Call("iprintlnbold", "Equipment: ON");
               equipment = true;
           }
           if (message.StartsWith("!equipoff"))
           {
               player.Call("iprintlnbold", "Equipment: OFF");
               equipment = false;
           }

           // Statements
               if (norecoil)
               {
                   player.Call("recoilscaleon", 0f);
               }
               else
               {
                   player.Call("recoilscaleon", 1f);
               }

               if (equipment)
               {
                   player.Call("giveMaxAmmo", offhand);
               }

       }
       public void createPlayerHud(Entity player)
       {
           HudElem text1 = HudElem.CreateFontString(player, "hudSmall", 1f);
           text1.SetPoint("BOTTOM RIGHT", "BOTTOM RIGHT", -200, 50);
           text1.HideWhenInMenu = true;

           OnInterval(100, () =>
           {
               text1.SetText("Health: " + player.Health);
               return true;
           });
       }
   }
}

Featured Replies

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

anyone please?

Опубликовано:
Look at this script's source -> viewtopic.php?f=40&t=9585

Try to get some ideas from it.

I tried to look at his code, but i really can't understand his methods, perhaps i could use something more simple?

Опубликовано:
You need an oninterval if you set something and it goes away.

Yea dude i totally tried, but idk if i did it right, because the code was

           OnInterval(1000, () =>
           {
               if(equipment){
                       player.Call("giveMaxAmmo", offhand);
               }
           });

but when i did that and typed the command, the server would freeze for 1 sec and give me ammo once. not every 1 second.

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.