Hey!
I wish to save players' weapons and ammo when they disconnect and give the weapons and ammo back correctly when they come online again. I've found a very useful post, which saves the weapons and gives them back later, I managed to implement it in my script properly and it works flawlessly, but I don't know how can I save the weapons' ammo in the backpack AND in the clip of the weapons.
A small note: My script enables having multiple primary and secondary weapons, if this changes anything.
Any help would be appreciated!
Edit: I forgot to quote the post about weapon saving (if this provides any help):
Quote:
Originally Posted by Bugsy
To block weapon purchase you could destroy the buyzone: http://forums.alliedmods.net/showthread.php?t=89676
Not sure if this is exactly what you need but this is a quick and easy way to save\restore weapons.
Save weapons:
PHP Code:
g_PlayerWeapons[id] = pev( id , pev_weapons ) &~ ( 1 << 31 );
Restore weapons:
PHP Code:
//To restore grenades you will need to set bpammo accordingly. new iValue = g_PlayerWeapons[id];
for( new j = 1 ; j <= 30 ; j++ ) { if ( (1 & (iValue >> j)) && ( j != 2 ) && ( j != CSW_C4) && ( j != CSW_KNIFE ) ) { get_weaponname( j , szWeapon , 31 ); fm_give_item( id , szWeapon ); } }
|