Raised This Month: $ Target: $400
 0% 

Solved [ H3LP ] block Pickup weapons?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-03-2017 , 14:31   [ H3LP ] block Pickup weapons?
Reply With Quote #1

Hello, I'm trying to block pickup weapons with impulse. I don't know exactly, but the impulse for all weapons is equal of "0".

Weapon code.
PHP Code:
register_forward(FM_SetModel"fw_SetModel");

...

public 
fw_SetModel(entity, const model[])
{
    if (!
is_valid_ent(entity))
        return 
FMRES_IGNORED;

    if (!
equal(model"models/w_scout.mdl"))
        return 
FMRES_IGNORED;

    static 
classname[32];
    
entity_get_string(entityEV_SZ_classnameclassnamecharsmax(classname));

    if (!
equal(classname"weaponbox"))
        return 
FMRES_IGNORED;

    static 
ownerweapon;
    
owner entity_get_edict(entityEV_ENT_owner);
    
weapon find_ent_by_owner(-1"weapon_scout"entity);

    if (!
g_has_item[owner] || !is_valid_ent(weapon))
        return 
FMRES_IGNORED;

    
g_has_item[owner] = false;

    
entity_set_int(weaponEV_INT_impulse6781234);
    
entity_set_model(entityW_MODEL_MDL);

    return 
FMRES_SUPERCEDE;

Ham_touch code
PHP Code:
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon");
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeapon");
RegisterHam(Ham_Touch"weapon_shield""fw_TouchWeapon");

...

public 
fw_TouchWeapon(entityid)
{
    if (!
is_valid_ent(entity))
        return 
HAM_IGNORED;

    if (!
is_user_alive(id))
        return 
HAM_IGNORED;
    
    static 
impulse;
    
impulse entity_get_int(entityEV_INT_impulse);

    if (
impulse <= 500000)
    {
        
client_print(idprint_chat"Impulse: %d"impulse);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

__________________









Last edited by CrazY.; 05-04-2017 at 09:42.
CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-03-2017 , 21:25   Re: [ H3LP ] block Pickup weapons?
Reply With Quote #2

Solved.
__________________








CrazY. is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 05-03-2017 , 23:16   Re: [ H3LP ] block Pickup weapons?
Reply With Quote #3

maybe this thread will give more infoos too: https://forums.alliedmods.net/showthread.php?t=287837
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-04-2017 , 06:06   Re: [ H3LP ] block Pickup weapons?
Reply With Quote #4

I only need register in the weapon entity origin.
__________________








CrazY. 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 15:02.


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