AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   WeaponList message and ammo (https://forums.alliedmods.net/showthread.php?t=253594)

wiwi249 12-24-2014 16:39

WeaponList message and ammo
 
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!

bibu 12-24-2014 16:56

Re: WeaponList message and ammo
 
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.

wiwi249 12-24-2014 21:00

Re: WeaponList message and ammo
 
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...

NiHiLaNTh 12-25-2014 05:17

Re: WeaponList message and ammo
 
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.

wiwi249 12-25-2014 20:14

Re: WeaponList message and ammo
 
Thanks, I set the values you told me, NiHiLaNth and that did the trick. Thank you!


All times are GMT -4. The time now is 15:20.

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