Raised This Month: $51 Target: $400
 12% 

How to get Maximum weapon slots number?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-14-2020 , 10:47   How to get Maximum weapon slots number?
Reply With Quote #1

How to get Maximum weapon slots number for [ANY] (each) game?

(for using in GetPlayerWeaponSlot())

e.g. 5 for L4D.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
J0BL3SS
Senior Member
Join Date: Sep 2020
Location: Turkey/Istanbul
Old 12-15-2020 , 06:38   Re: How to get Maximum weapon slots number?
Reply With Quote #2

//tf2
Code:
for(int victim=1; victim>=MaxClient; victim++)
        if(TF2_GetPlayerClass(victim) == TF2_GetClass("medic"))
        {
            int wSlot = GetPlayerWeaponSlot(victim, 1); //ubercharger, secondary weapon
                if (wSlot =! -1) //checks his ubercharger weapon is existed
                {
//do whatever you like with his secondary weapon
                    SetEntPropFloat(wSlot, Prop_Send, "m_flChargeLevel", 0.50); //sets weapons ubercharge value
                }
            }
for tf2 weapons slots goes like this
Weapon def indexs
0 = Primary
1 = Secondary
2 = Melee

im not sure how can you get maximum slots of a player
__________________
My Steam Profile
My Discord Name: J0BL3SS#5320 | j0bl3ss

I don't really look at steam or alliedmodders, contact me from discord if you need it.
J0BL3SS is offline
StrikeR14
AlliedModders Donor
Join Date: Apr 2016
Location: Behind my PC
Old 12-22-2020 , 12:17   Re: How to get Maximum weapon slots number?
Reply With Quote #3

That would give you the current amount of slots, but you can iterate through the weapon slots and count each.
__________________
Currently taking TF2/CSGO paid private requests!

My Plugins | My Discord Account
StrikeR14 is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-22-2020 , 12:29   Re: How to get Maximum weapon slots number?
Reply With Quote #4

To be clear:

I want to show a log to admin, which weapon is in which slot (universal plugin for ALL games).
Like:
Quote:
Slot 0 - weapon_awp
Slot 1 - nothing
Slot 2 - nothing
Slot 3 - nothing (last slot)
I don't need superfluous info in log, like:
Quote:
slot 4 - nothing
slot 5 - nothing
if that game don't have 4, 5 slots at all.

GetPlayerWeaponSlot() can't give me such info.
It return -1 both for case when no weapon in slot, and a case when there are no such slot index.

One way is: to make an array - [Game Name Index] => [Last Slot Index].
But, that's require from me to install each game, and manually check how many slots does it have.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 12-22-2020 at 12:31.
Dragokas is offline
tabishshah139
Junior Member
Join Date: Feb 2023
Old 02-07-2023 , 04:45   Re: How to get Maximum weapon slots number?
Reply With Quote #5

And what about Left 4 dead 1 multiple slots like ( slot 1 shot gun ) (slot 2 Sniper) depend on selection.
tabishshah139 is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 02-07-2023 , 15:35   Re: How to get Maximum weapon slots number?
Reply With Quote #6

Make a function where if the game is x the max slots are y. Simple as that.... or check for -1 and stop.

Last edited by AnimalMonster; 02-07-2023 at 15:36.
AnimalMonster is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode