Jump to content
Sign in to follow this  
Maldonado18

Add Itens To HotBar (shortCut)

Recommended Posts

how do i edit my init.c so that a gun can appear on the hotbar?

itemEnt = player.GetInventory (). CreateInInventory ("M4A1"); - In this line, I'm saying that my character will be born with an M4, right? and how do I put this m4 on the shortcut bar? (hotBar) follows the photo.


https://prnt.sc/rk1arj

Share this post


Link to post
Share on other sites

This is how I do it:

private EntityAI weapon1;
weapon1 = player.GetInventory().CreateInInventory("M4A1");
player.SetQuickBarEntityShortcut(weapon1, 0);

The first argument in the last line, "weapon1", refers to the object you want to place in the quickbar. It can be called whatever, as long as you are consistent throughout the code. The second argument, "0", indicates the first quickbar button. Adjust it to your liking.

You can keep adding more weapons like this:

private EntityAI weapon2;
weapon2 = player.GetInventory().CreateInInventory("Glock19");
player.SetQuickBarEntityShortcut(weapon2, 1);

 

Edited by NoBeansForMe

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
Sign in to follow this  

×