AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Strip weapons then give them back (https://forums.alliedmods.net/showthread.php?t=188350)

Jelle 06-25-2012 11:09

Strip weapons then give them back
 
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?

meTaLiCroSS 06-25-2012 16:04

Re: Strip weapons then give them back
 
Search on Code Snippets/Tutorials for ham_strip_weapon

Doc-Holiday 06-25-2012 16:45

Re: Strip weapons then give them back
 
Quote:

Originally Posted by Jelle (Post 1735813)
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..


All times are GMT -4. The time now is 06:12.

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