AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Strip user (https://forums.alliedmods.net/showthread.php?t=89208)

TitANious 04-03-2009 17:09

Strip user
 
how to strip users primary weapon?

ot_207 04-03-2009 17:13

Re: Strip user
 
PHP Code:

stock fm_strip_user_weapons(index) {
    new 
ent fm_create_entity("player_weaponstrip");
    if (!
pev_valid(ent))
        return 
0;

    
dllfunc(DLLFunc_Spawnent);
    
dllfunc(DLLFunc_Useentindex);
    
engfunc(EngFunc_RemoveEntityent);

    return 
1;



SnoW 04-03-2009 17:14

Re: Strip user
 
Quote:

Originally Posted by ot_207 (Post 796579)
PHP Code:

stock fm_strip_user_weapons(index) {
    new 
ent fm_create_entity("player_weaponstrip");
    if (!
pev_valid(ent))
        return 
0;
 
    
dllfunc(DLLFunc_Spawnent);
    
dllfunc(DLLFunc_Useentindex);
    
engfunc(EngFunc_RemoveEntityent);
 
    return 
1;



That would strip player's all weapons.
Quote:

Originally Posted by TitANious (Post 796575)
how to strip users primary weapon?


ot_207 04-03-2009 17:17

Re: Strip user
 
Quote:

Originally Posted by SnoW (Post 796581)
That would strip player's all weapons. I believe he wants only primary weapons.

http://forums.alliedmods.net/showthread.php?p=472306
This plugin stripes the weapon a player wants to sell so this should be it. Try to analyse this code.


Or another method would be to see before he strips the weapons what weapons the client has, and after that to regive the weapons that the client had...

alan_el_more 04-03-2009 17:24

Re: Strip user
 
PHP Code:

stock bool:fm_strip_user_gun(indexwid 0, const wname[] = "") { 
    new 
ent_class[32]
    if (!
wid && wname[0])
        
copy(ent_class31wname)
    else {
        new 
weapon widclipammo
        
if (!weapon && !(weapon get_user_weapon(indexclipammo)))
            return 
false
        
        get_weaponname
(weaponent_class31)
    }

    new 
ent_weap fm_find_ent_by_owner(-1ent_classindex)
    if (!
ent_weap)
        return 
false

    engclient_cmd
(index"drop"ent_class)

    new 
ent_box pev(ent_weappev_owner)
    if (!
ent_box || ent_box == index)
        return 
false

    dllfunc
(DLLFunc_Thinkent_box)

    return 
true


fm_strip_user_gun(id, "id of weapon")

the id's is here

SnoW 04-03-2009 17:31

Re: Strip user
 
Quote:

Originally Posted by ot_207 (Post 796584)
Or another method would be to see before he strips the weapons what weapons the client has, and after that to regive the weapons that the client had...

No, better to remove only primary weapons.
@alan el more, now we got the real function. Now we just need a method to get player's all primary weapons' ids.

TitANious 04-03-2009 17:34

Re: Strip user
 
Problem fixed

One 04-03-2009 17:50

Re: Strip user
 
client_cmd(id, "slot1; drop")

easiest way :mrgreen:

ConnorMcLeod 04-03-2009 17:58

Re: Strip user
 
Something like this :

PHP Code:

#define m_rgpPlayerItems_Slot1    367
#define m_pActiveItem            373

#define    m_pNext                42


Strip_User_Primariesid )
{
    new 
iWeaponiNextiActiveItem
    iWeapon 
get_pdata_cbase(idm_rgpPlayerItems_Slot1)
    
iActiveItem get_pdata_cbase(idm_pActiveItem)
    while( 
pev_valid(iWeapon) )
     {
        
iNext get_pdata_cbase(iWeaponm_pNext4)
        if( 
iActiveItem == iWeapon )
        {
            
ExecuteHam(Ham_Item_HolsteriWeapon)
        }
        
set_pev(iWeaponpev_flagspev(iWeaponpev_flags) | FL_KILLME)
        
iWeapon iNext
    
}



One 04-03-2009 18:03

Re: Strip user
 
its to high for titan. you said :

Quote:

Wrong, you should understand any code you use first.
:mrgreen:
anyways, he fixed the plug & i think the problem is fixed. idk


All times are GMT -4. The time now is 02:22.

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