Raised This Month: $ Target: $400
 0% 

Editing weapon help please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-24-2007 , 22:25   Editing weapon help please
Reply With Quote #1

I am trying to edit an existing weapon to create a 'new' weapon. Such as removing the existing weapons properties, then assigning new ones to it.

I thought to start I should remove the existing weapons fire and sound. I read the tutorial here on how to do that...
http://forums.alliedmods.net/showthread.php?t=41265

Now I have a problem because I can't capture when the player is holding attack.

Is there a way to remove all the existing weapons properties while still being able to detect when attack is being used?
hlstriker is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-26-2007 , 13:13   Re: Editing weapon help please
Reply With Quote #2

Is anyone able to help me with this?

I would appreciate it very much, thanks.
hlstriker is offline
mogel
Senior Member
Join Date: Jan 2007
Old 06-26-2007 , 14:50   Re: Editing weapon help please
Reply With Quote #3

Hi,

i have the same problem ... current i use a very bad workaround for the problem ... but i need a better solution

http://forums.alliedmods.net/showthread.php?p=424755

i think with this plugin is it posible to block the shoot, following by a fakedamage for the player ... please let me know if the idea work, thanks

hand, mogel
__________________
mogel is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2007 , 16:34   Re: Editing weapon help please
Reply With Quote #4

Post the code you're using to block the animation and sound.

I think if you use:

Code:
set_cd(cd_handle, CD_ID, 0)
then you might be able to see when a client is pressing the attack key. I'm not sure.
stupok is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-26-2007 , 18:45   Re: Editing weapon help please
Reply With Quote #5

Yeah that's what I'm using and I couldn't seem to figure it out. Here is the code...

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_forward(FM_UpdateClientData"UpdateClientData_Post"1);
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id))
    {
        return 
PLUGIN_CONTINUE;
    }
    
    
// Remove the attack button from their button mask
    
entity_set_int(idEV_INT_buttonentity_get_int(idEV_INT_button) & ~IN_ATTACK);
    
    if(
pev(idpev_button) & IN_ATTACK)
    {
        
// Added this to check if it would spam test when I held attack down
        
client_print(0print_chat"test");
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id))
    {
        return 
FMRES_IGNORED;
    }
    
    
set_cd(cd_handleCD_ID0);
    
    return 
FMRES_HANDLED;

hlstriker is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2007 , 20:13   Re: Editing weapon help please
Reply With Quote #6

What if you remove the line with entity_set_int? I don't think you need to remove the button AND change CD_ID with set_cd().
stupok is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-27-2007 , 03:51   Re: Editing weapon help please
Reply With Quote #7

Code:
public FM_CStart(id, uc_handle, seed, cd_handle) {     if((get_uc(uc_handle,UC_Buttons) & IN_ATTACK) ) {         //shit         set_uc(uc_handle,UC_Buttons, get_uc(uc_handle,UC_Buttons) & ~IN_ATTACK);     } }

or the same concept with pev and set_pev with prethink
kmal2t is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-27-2007 , 12:53   Re: Editing weapon help please
Reply With Quote #8

Works perfect, thanks.
hlstriker 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 21:27.


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