Jump to content
mastaZz

fast slot magazines

Recommended Posts

 

please tell me how to create one
 

void addMags(PlayerBase player, string mag_type, int count)
{
    if (count < 1)
        return;

    EntityAI mag;

    for (int i = 0; i < count; i++) {
        mag = player.GetInventory().CreateInInventory(mag_type);
    }

    player.SetQuickBarEntityShortcut(mag, 1, true);
}

EntityAI baikerClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("AKM");
	gun.GetInventory().CreateAttachment("AK_FoldingBttstck");
	gun.GetInventory().CreateAttachment("AK_RailHndgrd");
	gun.GetInventory().CreateAttachment("AK_Suppressor");
	gun.GetInventory().CreateAttachment("KobraOptic");
	EntityAI aspants = player.GetInventory().CreateInInventory("CargoPants_Black");
	EntityAI asjacket = player.GetInventory().CreateInInventory("RidersJacket_Black");
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	EntityAI helmet = player.GetInventory().CreateInInventory("MotoHelmet_Black");
	EntityAI asbag = player.GetInventory().CreateInInventory("CourierBag");
	addMags(player, "Mag_AKM_30Rnd", 3);

    return gun;
}

 

what would all 3 magazines be in fast slots, instead of one?

Share this post


Link to post
Share on other sites

for (int i = 0; i < count; i++)

{

mag = player.GetInventory().CreateInInventory(mag_type);

player.SetQuickBarEntityShortcut(mag, i, true);
}

 

Edited by cdiehr
edit
  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, cdiehr said:

for (int i = 0; i <count; i ++)

{

mag = player.GetInventory (). CreateInInventory (mag_type);

player.SetQuickBarEntityShortcut (mag, i, true);
}

 

 

Thanks for the reply, but in this case only one magazine. in slot 4

Share this post


Link to post
Share on other sites
4 hours ago, cdiehr said:

for (int i = 0; i <count; i ++)

{

mag = player.GetInventory (). CreateInInventory (mag_type);

player.SetQuickBarEntityShortcut (mag, i, true);
}

 

 

Thanks for the reply, but in this case only one magazine. in slot 4

Share this post


Link to post
Share on other sites

I didn't try it, but I have this working in my init.c:

player.SetQuickBarEntityShortcut(primary, 0, true);
player.SetQuickBarEntityShortcut(mag, 1, true);
player.SetQuickBarEntityShortcut(rags, 2, true);
player.SetQuickBarEntityShortcut(axe, 3, true);

so my code should work. 

Your code should looks like

void addMags(PlayerBase player, string mag_type, int count)

{ 
	if (count < 1) return; 
    EntityAI mag; 
	for (int i = 0; i < count; i++) 
	{ 
		mag = player.GetInventory().CreateInInventory(mag_type); 
		player.SetQuickBarEntityShortcut(mag, i, true); 
	}
}

(This should not work, if count < 1)

Edited by cdiehr
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, cdiehr said:

I didn't try it, but I have this working in my init.c:

player.SetQuickBarEntityShortcut(primary, 0, true);
player.SetQuickBarEntityShortcut(mag, 1, true);
player.SetQuickBarEntityShortcut(rags, 2, true);
player.SetQuickBarEntityShortcut(axe, 3, true);

so my code should work. 

Your code should looks like


void addMags(PlayerBase player, string mag_type, int count)

{ 
	if (count < 1) return; 
    EntityAI mag; 
	for (int i = 0; i < count; i++) 
	{ 
		mag = player.GetInventory().CreateInInventory(mag_type); 
		player.SetQuickBarEntityShortcut(mag, i, true); 
	}
}

(This should not work, if count < 1)

 

added like you

player.SetQuickBarEntityShortcut(primary, 0, true);
player.SetQuickBarEntityShortcut(mag, 1, true);
player.SetQuickBarEntityShortcut(rags, 2, true);
player.SetQuickBarEntityShortcut(axe, 3, true);
 

 

on line     player.SetQuickBarEntityShortcut(mag, 1, true);

 

there was an error O_O

Share this post


Link to post
Share on other sites

 

 

I fixed the error

I assume it works for you, because you are using 1 fast slot on magazine.

But how to create 3 fast slots with 3 magazine? sorry for my English

Edited by mastaZz

Share this post


Link to post
Share on other sites

 

This is what I got in the end and it does not work as I want (((

void addMags(PlayerBase player, string mag_type, int count)
{
    if (count < 3)
        return;

    EntityAI mag;

    for (int i = 0; i < count; i++) {
        mag = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag, i, true);
    }
	
 player.SetQuickBarEntityShortcut (mag, 1, true);	

}

EntityAI baikerClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("AKM");
	gun.GetInventory().CreateAttachment("AK_FoldingBttstck");
	gun.GetInventory().CreateAttachment("AK_RailHndgrd");
	gun.GetInventory().CreateAttachment("AK_Suppressor");
	gun.GetInventory().CreateAttachment("KobraOptic");
	EntityAI aspants = player.GetInventory().CreateInInventory("CargoPants_Black");
	EntityAI asjacket = player.GetInventory().CreateInInventory("RidersJacket_Black");
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	EntityAI helmet = player.GetInventory().CreateInInventory("MotoHelmet_Black");
	EntityAI asbag = player.GetInventory().CreateInInventory("CourierBag");
	addMags(player, "Mag_AKM_30Rnd", 3);

    return gun;
}

 

Edited by mastaZz

Share this post


Link to post
Share on other sites

Try this for a test. it works only for 3 magazines:

void addMags(PlayerBase player, string mag_type, int count)
{
  		EntityAI mag;
        mag = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag, 0, true);
		EntityAI mag1;
        mag1 = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag1, 1, true);
		EntityAI mag2;
        mag2 = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag2, 2, true);
}

EntityAI baikerClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("AKM");
	gun.GetInventory().CreateAttachment("AK_FoldingBttstck");
	gun.GetInventory().CreateAttachment("AK_RailHndgrd");
	gun.GetInventory().CreateAttachment("AK_Suppressor");
	gun.GetInventory().CreateAttachment("KobraOptic");
	EntityAI aspants = player.GetInventory().CreateInInventory("CargoPants_Black");
	EntityAI asjacket = player.GetInventory().CreateInInventory("RidersJacket_Black");
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	EntityAI helmet = player.GetInventory().CreateInInventory("MotoHelmet_Black");
	EntityAI asbag = player.GetInventory().CreateInInventory("CourierBag");
	addMags(player, "Mag_AKM_30Rnd", 3);

    return gun;
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites
47 minutes ago, cdiehr said:

Try this for a test. it works only for 3 magazines:


void addMags(PlayerBase player, string mag_type, int count)
{
  		EntityAI mag;
        mag = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag, 0, true);
		EntityAI mag1;
        mag1 = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag1, 1, true);
		EntityAI mag2;
        mag2 = player.GetInventory().CreateInInventory(mag_type);
		player.SetQuickBarEntityShortcut(mag2, 2, true);
}

EntityAI baikerClass(PlayerBase player)
{
	EntityAI gun = player.GetInventory().CreateInInventory("AKM");
	gun.GetInventory().CreateAttachment("AK_FoldingBttstck");
	gun.GetInventory().CreateAttachment("AK_RailHndgrd");
	gun.GetInventory().CreateAttachment("AK_Suppressor");
	gun.GetInventory().CreateAttachment("KobraOptic");
	EntityAI aspants = player.GetInventory().CreateInInventory("CargoPants_Black");
	EntityAI asjacket = player.GetInventory().CreateInInventory("RidersJacket_Black");
    EntityAI asboots = player.GetInventory().CreateInInventory("CombatBoots_Black");
	EntityAI helmet = player.GetInventory().CreateInInventory("MotoHelmet_Black");
	EntityAI asbag = player.GetInventory().CreateInInventory("CourierBag");
	addMags(player, "Mag_AKM_30Rnd", 3);

    return gun;
}

 

 

friend i love you it works))) thank you so much

Share this post


Link to post
Share on other sites

Ok, I have not really a plan of c# or c++ or what ever this is :)

Remember, this only sets 3 magazines. The count parameter is not read anymore.

  • Like 1

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

×