mastaZz 0 Posted October 17, 2018 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
ZombieCooKie 10 Posted October 17, 2018 (edited) for (int i = 0; i < count; i++) { mag = player.GetInventory().CreateInInventory(mag_type); player.SetQuickBarEntityShortcut(mag, i, true); } Edited October 17, 2018 by cdiehr edit 1 Share this post Link to post Share on other sites
mastaZz 0 Posted October 17, 2018 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
mastaZz 0 Posted October 17, 2018 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
ZombieCooKie 10 Posted October 17, 2018 (edited) 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 October 17, 2018 by cdiehr 1 Share this post Link to post Share on other sites
mastaZz 0 Posted October 17, 2018 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
mastaZz 0 Posted October 17, 2018 (edited) 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 October 17, 2018 by mastaZz Share this post Link to post Share on other sites
mastaZz 0 Posted October 17, 2018 (edited) 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 October 17, 2018 by mastaZz Share this post Link to post Share on other sites
ZombieCooKie 10 Posted October 17, 2018 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; } 1 Share this post Link to post Share on other sites
mastaZz 0 Posted October 17, 2018 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
ZombieCooKie 10 Posted October 17, 2018 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. 1 Share this post Link to post Share on other sites
mastaZz 0 Posted October 17, 2018 Thanks, I'll keep it in mind Share this post Link to post Share on other sites