AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ SOLVED ] Strip especified user weapon? (https://forums.alliedmods.net/showthread.php?t=272785)

CrazY. 10-06-2015 09:39

[ SOLVED ] Strip especified user weapon?
 
Hi , is there any way strip weapons specified , for example , if the User spawn with Glock , then it is automatically removed , only that the other arms continue with it. Here is a code that might help you.

PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta_util >

public plugin_init() 
{
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
}

public 
fwHamPlayerSpawnPost(id
{
    
fm_strip_user_weapons(id);
    
set_pdata_int(id1160);
    
fm_give_item(id"weapon_knife");



zmd94 10-06-2015 12:26

Re: [HELP] Strip especified user weapon?
 
Is this tutorial or problem?

Krtola 10-06-2015 13:52

Re: [HELP] Strip especified user weapon?
 
Try this:

PHP Code:

RegisterHam(Ham_Item_Deploy"weapon_glock""Ham_Deploy"1

PHP Code:

public Ham_Deploy(ent)
{
    static 
idid fm_cs_get_weapon_ent_owner(ent)

    if (!
pev_valid(id))
    return

    
    
fm_strip_user_weapons(id)
            
    
fm_give_item(id"weapon_knife")



Hartmann 10-06-2015 15:07

Re: [HELP] Strip especified user weapon?
 
Use fun model instead fakemeta_util, and spawn check the player is alive.

PHP Code:

if (is_user_alive(id)) 


CrazY. 10-06-2015 16:27

Re: [HELP] Strip especified user weapon?
 
Quote:

Originally Posted by zmd94 (Post 2350355)
Is this tutorial or problem?

Problem.

Quote:

Originally Posted by Krtola (Post 2350392)
Try this:

PHP Code:

RegisterHam(Ham_Item_Deploy"weapon_glock""Ham_Deploy"1

PHP Code:

public Ham_Deploy(ent)
{
    static 
idid fm_cs_get_weapon_ent_owner(ent)

    if (!
pev_valid(id))
    return

    
    
fm_strip_user_weapons(id)
            
    
fm_give_item(id"weapon_knife")



Compilation error:
PHP Code:

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta_util >

public plugin_init() 
{
    
RegisterHam(Ham_Item_Deploy"weapon_glock""Ham_Deploy"1);
}

public 
Ham_Deploy(ent)
{
    if (
is_user_alive(id))
    {
        static 
idid fm_cs_get_weapon_ent_owner(ent);

        if (!
pev_valid(id));
        return;

        
        
fm_strip_user_weapons(id);
                
        
fm_give_item(id"weapon_knife");
    }



Krtola 10-06-2015 17:17

Re: [HELP] Strip especified user weapon?
 
You dont need is user alive check...

PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "Glock is Block"
#define VERSION "1.0"
#define AUTHOR "Krtola"

const OFFSET_LINUX_WEAPONS 4
const OFFSET_WEAPONOWNER 41

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Item_Deploy"weapon_glock""Ham_Deploy"1);
}

stock fm_cs_get_weapon_ent_owner(ent)
{
    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS)
}

public 
Ham_Deploy(ent)
{
        static 
idid fm_cs_get_weapon_ent_owner(ent)

        if (!
pev_valid(id))
        return;

        
fm_strip_user_weapons(id)
                
        
fm_give_item(id"weapon_knife")



CrazY. 10-06-2015 17:31

Re: [HELP] Strip especified user weapon?
 
Did not work.

wickedd 10-06-2015 17:34

Re: [HELP] Strip especified user weapon?
 
PHP Code:

weapon_glock 

:arrow:

PHP Code:

weapon_glock18 


Krtola 10-06-2015 17:38

Re: [HELP] Strip especified user weapon?
 
I had no idea that the proper write weapon_glock18

:oops:

CrazY. 10-06-2015 17:39

Re: [HELP] Strip especified user weapon?
 
Thanks , it worked , but to strip USP/GLOCK18 this is valid?

PHP Code:

#include <amxmodx> 
#include <hamsandwich> 
#include <fakemeta_util> 

#define PLUGIN "Glock is Block" 
#define VERSION "1.0" 
#define AUTHOR "Krtola" 

const OFFSET_LINUX_WEAPONS 
const OFFSET_WEAPONOWNER 41 

public plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR

    
RegisterHam(Ham_Item_Deploy"weapon_glock18""Ham_Deploy"1);
    
RegisterHam(Ham_Item_Deploy"weapon_usp""Ham_Deploy"1); 


stock fm_cs_get_weapon_ent_owner(ent

    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS


public 
Ham_Deploy(ent

        static 
idid fm_cs_get_weapon_ent_owner(ent

        if (!
pev_valid(id)) 
        return; 

        
fm_strip_user_weapons(id
                 
        
fm_give_item(id"weapon_knife"




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

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