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

[SOLVED] Issue with cstrike.inc and weaponid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 08-20-2013 , 16:53   [SOLVED] Issue with cstrike.inc and weaponid
Reply With Quote #1

Currently the listing for weaponids in cstrike.inc is:
Code:
enum CSWeaponID
{
    CSWeapon_NONE = 0,
    CSWeapon_P228,
    CSWeapon_GLOCK,
    CSWeapon_SCOUT,
    CSWeapon_HEGRENADE,
    CSWeapon_XM1014,
    CSWeapon_C4,
    CSWeapon_MAC10,
    CSWeapon_AUG,
    CSWeapon_SMOKEGRENADE,
    CSWeapon_ELITE,
    CSWeapon_FIVESEVEN,
    CSWeapon_UMP45,
    CSWeapon_SG550,
    CSWeapon_GALIL,
    CSWeapon_FAMAS,
    CSWeapon_USP,
    CSWeapon_AWP,
    CSWeapon_MP5NAVY,
    CSWeapon_M249,
    CSWeapon_M3,
    CSWeapon_M4A1,
    CSWeapon_TMP,
    CSWeapon_G3SG1,
    CSWeapon_FLASHBANG,
    CSWeapon_DEAGLE,
    CSWeapon_SG552,
    CSWeapon_AK47,
    CSWeapon_KNIFE,
    CSWeapon_P90,
    CSWeapon_SHIELD,
    CSWeapon_KEVLAR,
    CSWeapon_ASSAULTSUIT,
    CSWeapon_NIGHTVISION,
    CSWeapon_GALILAR,
    CSWeapon_BIZON,
    CSWeapon_MAG7,
    CSWeapon_NEGEV,
    CSWeapon_SAWEDOFF,
    CSWeapon_TEC9,
    CSWeapon_TASER,
    CSWeapon_HKP2000,
    CSWeapon_MP7,
    CSWeapon_MP9,
    CSWeapon_NOVA,
    CSWeapon_P250,
    CSWeapon_SCAR17,
    CSWeapon_SCAR20,
    CSWeapon_SG556,
    CSWeapon_SSG08,
    CSWeapon_KNIFE_GG,
    CSWeapon_MOLOTOV,
    CSWeapon_DECOY,
    CSWeapon_INCGRENADE,
    CSWeapon_DEFUSER
};
I am led to believe that it is missing the m4a1_silencer as well as the usp_silencer. If this is so, it would explain why I am having issues with allotting the correct ammo amount to weapons. As well as, an issue with compiling and using weapon give.

Can anyone confirm if this suspicion is correct?

*note: I do see CSWeapon_USP but I am not sure if that is correct.

I am referencing: CS Weapon Information & CS Weapon Constants

Last edited by Maxximou5; 08-22-2013 at 18:16. Reason: solved
Maxximou5 is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-21-2013 , 01:09   Re: Issue with cstrike.inc and weaponid
Reply With Quote #2

usp_silencer has no id in csgo. m4a1_silencer returns CSWeapon_M4A1. If you however use one of the natives to get a weapons id usp_silencer will return CSWeapon_HKP2000. They should return the id of the gun they replace. Can you explain what you want the id for? Also note the pages you linked are for CS 1.6

Last edited by Dr!fter; 08-21-2013 at 01:10.
Dr!fter is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 08-21-2013 , 02:33   Re: Issue with cstrike.inc and weaponid
Reply With Quote #3

I've been working on the Deathmatch 1.5 plugin and have been checking the code to make sure things are in proper placement with the recent update. I have been having particular trouble with the ammo, I am unsure what the problem could be as it changes from weapon to weapon. First trouble was adding ammo to the USP-S and M4A1-S, since then I have corrected it, but only caused another issue with another weapon.

Yes, the pages are for 1.6, is there for one for GO specifically or is it Source. As well the include file for the plugin uses cstrike.inc.

Thanks for looking into this btw.

Open to anyone to answer, could I receive help with this or any plugin development in IRC?
Maxximou5 is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-21-2013 , 03:00   Re: Issue with cstrike.inc and weaponid
Reply With Quote #4

Quote:
Originally Posted by Maxximou5 View Post
I've been working on the Deathmatch 1.5 plugin and have been checking the code to make sure things are in proper placement with the recent update. I have been having particular trouble with the ammo, I am unsure what the problem could be as it changes from weapon to weapon. First trouble was adding ammo to the USP-S and M4A1-S, since then I have corrected it, but only caused another issue with another weapon.

Yes, the pages are for 1.6, is there for one for GO specifically or is it Source. As well the include file for the plugin uses cstrike.inc.

Thanks for looking into this btw.

Open to anyone to answer, could I receive help with this or any plugin development in IRC?
There isn't much in docs for the weaponID's but basically its just an ID that the game uses to identify weapons, Its mostly only useful for calling server functions or an easy way to track guns. I'm having a hard time thinking of anything for ammo (3 am...) but you could look at how CS:S DM handles ammo (it does a function call). Can you paste the code you are using? And what the exact problem is

Also, for IRC you are more then welcome to ask questions about plugin development (that's what its for!) I'm usually in there along with many other people capable of helping you out (note sometimes it might take a while to get an answer due to people needing sleep ).

Last edited by Dr!fter; 08-21-2013 at 03:00.
Dr!fter is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 08-21-2013 , 15:21   Re: Issue with cstrike.inc and weaponid
Reply With Quote #5

Dr!fter, thanks for looking into this and I noticed you did work on the 3891 release checking for weaponID's. I appreciate the work. As well I can't wait to join you all in IRC.

The problem I am having is the value checks for the weapon ammo. It's of course based off a timer check:
PHP Code:
CreateTimer(10.0GiveAmmoINVALID_HANDLETIMER_REPEAT); 
Here is the section of code I am having the problem with:
PHP Code:
public Action:GiveAmmo(Handle:timer)
{
    static 
ammoCounts[] = { 035909040200301203210052100}; // Originally was:    static ammoCounts[] = { 0, 35, 90, 90, 200, 30, 120, 32, 100, 52, 100, 1, 1, 1, 1, 1 };
    
    
if (enabled && replenishAmmo)
    {
        for (new 
1<= MaxClientsi++)
        {
            if (!
roundEnded && IsClientInGame(i) && (Teams:GetClientTeam(i) > TeamSpectator) && IsPlayerAlive(i))
            {
                new 
activeWeapon GetEntDataEnt2(iactiveWeaponOffset);
                if (
activeWeapon != -1)
                {
                    new 
primary GetPlayerWeaponSlot(i_:SlotPrimary);
                    new 
secondary GetPlayerWeaponSlot(i_:SlotSecondary);
                    if ((
activeWeapon != primary) && (activeWeapon != secondary))
                        continue;
                    
                    new 
ammoType GetEntData(activeWeaponammoTypeOffset);
                    if (
ammoType != -1)
                        
SetEntData(iammoOffset + (ammoType 4), ammoCounts[ammoType], 4true);
                }
            }
        }
    }
    return 
Plugin_Continue

Last edited by Maxximou5; 08-21-2013 at 15:22.
Maxximou5 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-21-2013 , 18:35   Re: Issue with cstrike.inc and weaponid
Reply With Quote #6

Quote:
Originally Posted by Maxximou5 View Post
The problem I am having is the value checks for the weapon ammo.
That code looks fine. What value checks? Do the silenced weapons have a different ammo type from the normal ones?
__________________
Peace-Maker is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-21-2013 , 22:39   Re: Issue with cstrike.inc and weaponid
Reply With Quote #7

Spoiler


Above is the ammo indexes in order (I got it straight from the server bin). Maybe that will help you.

Last edited by Dr!fter; 08-21-2013 at 22:40.
Dr!fter is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 08-21-2013 , 23:31   Re: Issue with cstrike.inc and weaponid
Reply With Quote #8

Quote:
Originally Posted by Peace-Maker View Post
That code looks fine. What value checks? Do the silenced weapons have a different ammo type from the normal ones?
That's what I was thinking, but I looked into it and that is not the case. As the M4A1-S uses the same ammo as the m4a1 and the USP-S uses the same ammo as the mac10 and ump. I believe I did the opposite of what I thought was right, I needed to ADD more values rather then removing. Hindsight is a *$%#@.

Thank you for ammo indexes!
Maxximou5 is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-22-2013 , 00:28   Re: Issue with cstrike.inc and weaponid
Reply With Quote #9

So am i right to assume that giving ammo isn't working for the new weapons? Or is it not giving the max? The ammo offset that you get is correct afaik (cssdm uses the same thing) So I guess your setting the values but its not being the max? Sorry I'm still not 100% sure what the problem was. As far as I can tell the code is correct besides that the ammoCounts array might need adjusting.
Dr!fter is offline
Maxximou5
AlliedModders Donor
Join Date: Feb 2013
Old 08-22-2013 , 03:22   Re: Issue with cstrike.inc and weaponid
Reply With Quote #10

Yes, the array is what is wrong. Sorry if I wasn't being specific enough, I should of stated that obviously. Ammo isn't getting to the correct weapons. When I adjusted it, to what was posted earlier compared to the earlier version (noted in the //), it would allocate the correct amount to the new weapons but always left one weapon unfilled. To be more precise, originally ally weapons BUT the m4a1-s and the usp-s would get ammo replenished during the checktimer. When I adjusted it, the m4a1-s and the usp-s would get the correct ammo but would leave one weapon without, such as the fiveseven (as of current release 1.5.4).
Maxximou5 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 07:42.


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