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

Strip weapons then give them back


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-25-2012 , 11:09   Strip weapons then give them back
Reply With Quote #1

I have just started to work with ZP, and a lot has changed from 4.3 to 5.0. But that's not really relevant here.

What I want to do, when a user buys an item, is that I want to strip all his weapons, and then give them all back to him but the primary one since he bought a new one.

Maybe there is an easier way to do it. I found a stock:

PHP Code:
stock drop_prim(id
{
    new 
weapons[32], num
    get_user_weapons
(idweaponsnum)
    for (new 
0numi++)
    {
        if (
Wep_ak47 & (1<<weapons[i])) 
        {
            static 
wname[32]
            
get_weaponname(weapons[i], wnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }

But that one just throws the weapons on the ground, they can be picked up by anyone when that code has been executed.

Any ideas?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 06-25-2012 , 16:04   Re: Strip weapons then give them back
Reply With Quote #2

Search on Code Snippets/Tutorials for ham_strip_weapon
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 06-25-2012 , 16:45   Re: Strip weapons then give them back
Reply With Quote #3

Quote:
Originally Posted by Jelle View Post
I have just started to work with ZP, and a lot has changed from 4.3 to 5.0. But that's not really relevant here.

What I want to do, when a user buys an item, is that I want to strip all his weapons, and then give them all back to him but the primary one since he bought a new one.

Maybe there is an easier way to do it. I found a stock:

PHP Code:
stock drop_prim(id
{
    new 
weapons[32], num
    get_user_weapons
(idweaponsnum)
    for (new 
0numi++)
    {
        if (
Wep_ak47 & (1<<weapons[i])) 
        {
            static 
wname[32]
            
get_weaponname(weapons[i], wnamesizeof wname 1)
            
engclient_cmd(id"drop"wname)
        }
    }

But that one just throws the weapons on the ground, they can be picked up by anyone when that code has been executed.

Any ideas?
you can set the flag to kill me and delete the weapon if you can get the entity index..
Doc-Holiday 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 12:26.


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