Raised This Month: $ Target: $400
 0% 

pev_button, i dont understand very well...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_lol_
Senior Member
Join Date: Apr 2009
Old 04-12-2009 , 22:47   pev_button, i dont understand very well...
Reply With Quote #1

well, i am doing a plugin, but i have a problem...i want to do that when a player is ducking, the viewmodel will be one, but, that when the player is not ducking, the viewmodel will be another...
this is my code.
Code:
            // Get currently pressed buttons
            static buttons
            buttons = pev(id, pev_button)
        
            if(buttons & IN_DUCK)
            {
                set_pev(id, pev_viewmodel, 0)
            }
            else
            {
                set_pev(id, pev_viewmodel, zclass_clawmodel)
            }
it is working, but not at all, because if at the time that this function is called, you are ducking, you wont have any viewmodel, but if you stop ducking, you will still without any viewmodel lol!

so...whats the problem?
_lol_ is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-13-2009 , 00:10   Re: pev_button, i dont understand very well...
Reply With Quote #2

The code you have used is correct. But it depends where are this function is placed.
If you put it for example in PRETHINK it would work like a charm .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
Old 04-13-2009, 06:16
Anggara_nothing
This message has been deleted by Anggara_nothing. Reason: opss.....
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-13-2009 , 06:22   Re: pev_button, i dont understand very well...
Reply With Quote #4

You're wrong Anggara_nothing.
Arkshine is offline
_lol_
Senior Member
Join Date: Apr 2009
Old 04-13-2009 , 12:50   Re: pev_button, i dont understand very well...
Reply With Quote #5

so...whats bad now...the debug client_print IS working, but there is no model, ducking or not doing it...


Code:
public client_PreThink(id) 
{
    if (!is_user_alive(id))
        return;
        
    if(zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_invisible)
    {
        // Get currently pressed buttons
        static buttons
        buttons = pev(id, pev_button)
        
        
        if(!(buttons & IN_DUCK))
        {
            client_print(id, print_chat, "[DEBUG] unducking.");
            set_pev(id, pev_viewmodel, zclass_clawmodel)
        }
        if(buttons & IN_DUCK)
        {
            client_print(id, print_chat, "[DEBUG] ducking");
            set_pev(id, pev_viewmodel, 0)
        }
        
    }
}
EDIT:this is the constant...
Code:
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" } // claw model

Last edited by _lol_; 04-13-2009 at 15:21. Reason: forgot to show the constant
_lol_ is offline
Old 04-13-2009, 21:02
_lol_
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
Reply


Thread Tools
Display Modes

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 02:20.


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