Jump to content
steam-76561198088513750

How does the flashlight of the reborn player come with batteries

Recommended Posts

This is my spawn code.(init.c)

player.GetInventory().CreateInInventory("FlashLight");

How to attach batteries to flashlight↑

I tried to write like this, but it didn't work↓

Please help me. I am a rookie. :)

player.GetInventory().CreateInInventory("FlashLight");
player.GetInventory().CreateAttachment("Batery9v");

 

Share this post


Link to post
Share on other sites
On 10/5/2019 at 10:20 PM, steam-76561198088513750 said:

I solved the problem myself.everybody don't have to reply.

You're nice man, but better write your way to solve that.

 

ItemBase flashlight = player.GetInventory().CreateInInventory("Flashlight"); //Create flashlite
flashlight.GetInventory().CreateAttachment("Battery9V"); // IN flashlite create battery
ItemBase.Cast(flashlight); // Save upcating
player.SetQuickBarEntityShortcut(flashlight, 4, true); // Set item to a slot of tray

 

Share this post


Link to post
Share on other sites

            EntityAI itemTop  = player.GetInventory().CreateInInventory("FlashLight");
            itemTop.GetInventory().CreateAttachment("Battery9V");

On 2019/11/2 at PM4点25分, Sid Debian said:

你是一个好人,但最好写出解决办法。

 


  
    

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×