Raised This Month: $ Target: $400
 0% 

WeaponList message and ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wiwi249
Member
Join Date: Oct 2013
Old 12-24-2014 , 16:39   WeaponList message and ammo
Reply With Quote #1

Hello there!
I've done a new plugin for my mod (a new weapon for CS), which you can see here:
https://www.youtube.com/watch?v=s7fyPTMZpys

The problem is with the ammo. I was following the tutorial here:
https://forums.alliedmods.net/showthread.php?t=175632
while making the plugin.

I'm sending
Code:
message_begin( MSG_ONE, MsgIndexWeaponList, .player = player ); 
        { 
            write_string( "weapon_sr25" );  // WeaponName 
            write_byte( 2 );                   // PrimaryAmmoID 
            write_byte( 20 );                   // PrimaryAmmoMaxAmount 
            write_byte( 2 );                   // SecondaryAmmoID 
            write_byte( 80 );                   // SecondaryAmmoMaxAmount 
            write_byte( 0 );                    // SlotID (0...N) 
            write_byte( 1 );                    // NumberInSlot (1...N) 
            write_byte( CSW_SG550 );            // WeaponID 
            write_byte( 0 );                    // Flags 
        } 
        message_end();
But had totally no idea what to do with the PrimaryAmmoID, PrimaryAmmoMaxAmount, SecondaryAmmoID, SecondaryAmmoMaxAmount.
As seen on the video, Bpammo is always 0, no matter how much primary ammo I buy. What's more - the weapon accually reloads when it can and if the ammo has been bought, but still the bpammo shows 0.
Anyone knows how to fix it? And could someone explain me those params:
PrimaryAmmoID, PrimaryAmmoMaxAmount, SecondaryAmmoID, SecondaryAmmoMaxAmount ?

Greets and Merry Christmas!
wiwi249 is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-24-2014 , 16:56   Re: WeaponList message and ammo
Reply With Quote #2

It shouldn't be that hard.

See these two links:

https://wiki.alliedmods.net/Half-lif...nts#WeaponList
https://github.com/Arkshine/CSSDK/bl.../wpn_sg550.cpp

You can simply copy the GetItemInfo datas.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.

Last edited by bibu; 12-24-2014 at 16:57.
bibu is offline
wiwi249
Member
Join Date: Oct 2013
Old 12-24-2014 , 21:00   Re: WeaponList message and ammo
Reply With Quote #3

Acctually I tried, but:
p->pszAmmo1 = "556Nato";
it's a string, and all I can send here are the int values.
Anyway, the 556Nato ammo ID is 2 i think, but not really sure.

Now the code looks like:
PHP Code:
message_beginMSG_ONEMsgIndexWeaponList, .player player ); 
        { 
            
write_string"weapon_sr25" );  // WeaponName 
            
write_byte);                   // PrimaryAmmoID 
            
write_byte90 );                   // PrimaryAmmoMaxAmount 
            
write_byte);                   // SecondaryAmmoID 
            
write_byte( -);                   // SecondaryAmmoMaxAmount 
            
write_byte);                    // SlotID (0...N) 
            
write_byte16 );                    // NumberInSlot (1...N) 
            
write_byteCSW_SG550 );            // WeaponID 
            
write_byte);                    // Flags 
        

        
message_end(); 
Still not working properly...

Last edited by wiwi249; 12-24-2014 at 21:00.
wiwi249 is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-25-2014 , 05:17   Re: WeaponList message and ammo
Reply With Quote #4

Which weapon you replace? SG-550? it has ammo id 4. And secondary ammod id / amount should be -1.
If you want to change ammo id, you need to hook Item_PrimaryAmmoIndex and override ammo and index and hook ItemInfo (only latest amxx) to override ammo there too. I'd suggest you to replace g3sg1, since it has ammo ID 2.
Cheers.
__________________


Last edited by NiHiLaNTh; 12-25-2014 at 05:18.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
wiwi249
Member
Join Date: Oct 2013
Old 12-25-2014 , 20:14   Re: WeaponList message and ammo
Reply With Quote #5

Thanks, I set the values you told me, NiHiLaNth and that did the trick. Thank you!
wiwi249 is offline
Reply


Thread Tools
Display Modes

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 15:20.


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