Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
Sign in to follow this  
Relic

Incompatible parameter в setInput()

 

Делаю свой пак гранатомётов для своего сервера, в целом - моя первая модификация сложнее ретекстура. Поскольку некоторые из них одноразки и раскладываются (в данном случае РПГ-18), захотелось сделать скрипт на замену в руках сложенного на разложенный граник при нажатии кнопки. Но с Action`ами никак подружиться не могу, не понимаю их логики и который час пытаюсь что то сделать. Что в данном случае ему не нравиться? Inputs.xml прописан, экшен создан. Направьте пожалуйста маслёнка в правильное русло
 

image.png.f89171cfac159e5bf264f990b8c0a2be.png

Основной скрипт:

class ActionSwapLauncher: ActionBase

{

    void ActionSwapLauncher(PlayerBase player)

    {  

        SetInput("UASwapLauncherRPG18");

        m_Text = "Разложить РПГ";

    }



    void OnStartServer(ActionData action_data)

    {

        super.OnStartServer(action_data);



        PlayerBase player = PlayerBase.Cast(action_data.m_Player);

        if (!player)

            return;



        Weapon_Base weapon = Weapon_Base.Cast(player.GetHumanInventory().GetEntityInHands());

        if (weapon && weapon.GetType() == "RPG18_Unloaded")

        {

            ReplaceWeapon(player, "RPG18");

        }

    }



    void ReplaceWeapon(PlayerBase player, string weaponType)

    {



        EntityAI newWeaponEntity = player.GetHumanInventory().CreateInHands(weaponType);

        if (newWeaponEntity)

        {

            Weapon_Base weapon = Weapon_Base.Cast(player.GetHumanInventory().GetEntityInHands());

            weapon.Delete();

            newWeaponEntity.GetInventory().CreateInInventory("RPG18_Ammo");

        }

    }



    bool CanUse(ActionData action_data)

    {

        PlayerBase player = PlayerBase.Cast(action_data.m_Player);

        Weapon_Base weapon = Weapon_Base.Cast(player.GetHumanInventory().GetEntityInHands());

        if (weapon && weapon.GetType() == "RPG18_Unloaded")

        {

            return true;

        }



        return false;

    }



    bool CanBeUsedInVehicle()

    {

        return false;

    }

    // override void OnStartClient(ActionData action_data)

    // {

    //     super.OnStartClient(action_data);

    //

    //    

    //     PlayActionSound(action_data.m_Player, "");

    // }



    // override void OnExecuteClient(ActionData action_data)

    // {

    //     super.OnExecuteClient(action_data);

    //     PlayActionSound(action_data.m_Player, "");

    // }



    // protected void PlayActionSound(PlayerBase player, string soundSetName)

    // {

    //     if (player)

    //     {

    //         EffectSound sound = SEffectManager.PlaySoundOnObject(soundSetName, player, 0, false);

    //         if (sound)

    //         {

    //             sound.SetAutodestroy(true);

    //         }

    //     }

    // }

}

ActionConstructor.c

 


modded class ActionConstructor

{

    override void RegisterActions(TTypenameArray actions)

    {

        super.RegisterActions(actions);

       

        actions.Insert(ActionSwapLauncher);

    }

};
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<modded_inputs>

    <inputs>

        <actions>

            <input name="UASwapLauncherRPG18" loc="Разложить РПГ-18" />

        </actions>

        <sorting name="TACTICS" loc="TCTS">

            <input name="UASwapLauncherRPG18"/>

        </sorting>

        <preset>

        <input name="UASwapLauncherRPG18">

            <btn name="Разложить РПГ-18"/>

        </input>

    </preset>

</modded_inputs>

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Поддержка