Raised This Month: $ Target: $400
 0% 

Saving player weapons and ammo


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Iceaac
Junior Member
Join Date: Oct 2009
Old 06-25-2012 , 07:10   Saving player weapons and ammo
Reply With Quote #1

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 View Post
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] = pevid pev_weapons ) &~ ( << 31 ); 
Restore weapons:
PHP Code:
//To restore grenades you will need to set bpammo accordingly.
new iValue g_PlayerWeapons[id];

for( new 
<= 30 j++ )
{
    if ( (
& (iValue >> j)) && ( != ) && ( != CSW_C4) && ( != CSW_KNIFE ) )
    {
        
get_weaponnameszWeapon 31 );
        
fm_give_itemid szWeapon );
    }


Last edited by Iceaac; 06-25-2012 at 07:16. Reason: Added weapon saving.
Iceaac is offline
 



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 06:14.


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