Raised This Month: $ Target: $400
 0% 

I have 2 questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B1ondu
Junior Member
Join Date: Apr 2007
Old 05-28-2007 , 09:31   I have 2 questions
Reply With Quote #1

1.How to catch +attack ?
2.How to check if current model is cell?
__________________

[IMG]http://img107.**************/img107/8208/ssj3gokublondusigor0.png[/IMG]
[IMG]http://img112.**************/img112/7394/umdeveloperec1.jpg[/IMG]
B1ondu is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-28-2007 , 09:39   Re: I have 2 questions
Reply With Quote #2

I would register prethink and check in there if user button +attack.
Like this:
Code:
public plugin_init()
{
    register_forward(FM_PlayerPreThink, "fm_playerthink", 1)
}

public fm_playerthink(id)
{
    if(pev(id, pev_button) & IN_ATTACK)
    {
        // do something
    }
}
What do you mean with "model is cell"?

greetz regalis
__________________
regalis is offline
B1ondu
Junior Member
Join Date: Apr 2007
Old 05-28-2007 , 09:41   Re: I have 2 questions
Reply With Quote #3

cell is a model ^^
__________________

[IMG]http://img107.**************/img107/8208/ssj3gokublondusigor0.png[/IMG]
[IMG]http://img112.**************/img112/7394/umdeveloperec1.jpg[/IMG]
B1ondu is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-28-2007 , 09:46   Re: I have 2 questions
Reply With Quote #4

Hmm, don't really know how to do this but i think that should work:
*edit* you need to include <fakemeta> for both ;) *edit*
Code:
new model[32]
pev(id, pev_model, model, 31)
if(equal(model, "cell")
{
    // do something :P
}
greetz regalis
__________________
regalis is offline
B1ondu
Junior Member
Join Date: Apr 2007
Old 05-28-2007 , 09:52   Re: I have 2 questions
Reply With Quote #5

thx, now other question:

How to check how much time i pressed +attack?
__________________

[IMG]http://img107.**************/img107/8208/ssj3gokublondusigor0.png[/IMG]
[IMG]http://img112.**************/img112/7394/umdeveloperec1.jpg[/IMG]

Last edited by B1ondu; 05-28-2007 at 10:12.
B1ondu is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-28-2007 , 10:08   Re: I have 2 questions
Reply With Quote #6

Here you go:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_attack[33];

public plugin_init()
{
    register_forward(FM_PlayerPreThink, "fm_playerthink", 1)
    set_task(2.0, "display_attack_num", 110477, "", 0, "b")
}

public fm_playerthink(id)
{
    if((pev(id, pev_button) & IN_ATTACK) && !(pev(id, pev_oldbuttons) & IN_ATTACK))
    {
        // do something
        g_attack[id]++;
    }
}

public display_attack_num()
{
    new playercount, Players[32]
    get_players(Players, playercount,"a")
    for (new i=0; i < playercount; ++i)
    {
        client_print(Players[i], print_chat, "attacks: %d", g_attack[Players[i]])
    }
}

+karma would be nice! ;)
__________________
regalis is offline
B1ondu
Junior Member
Join Date: Apr 2007
Old 05-28-2007 , 10:12   Re: I have 2 questions
Reply With Quote #7

thx

+karma man ;)
__________________

[IMG]http://img107.**************/img107/8208/ssj3gokublondusigor0.png[/IMG]
[IMG]http://img112.**************/img112/7394/umdeveloperec1.jpg[/IMG]
B1ondu is offline
B1ondu
Junior Member
Join Date: Apr 2007
Old 05-28-2007 , 10:17   Re: I have 2 questions
Reply With Quote #8

LOL other questions ^^

How to check if a player hold +attack ?
__________________

[IMG]http://img107.**************/img107/8208/ssj3gokublondusigor0.png[/IMG]
[IMG]http://img112.**************/img112/7394/umdeveloperec1.jpg[/IMG]
B1ondu is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-28-2007 , 10:27   Re: I have 2 questions
Reply With Quote #9

I think this should work
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_attack[33];
new holding_attack[33];

public plugin_init()
{
    register_forward(FM_PlayerPreThink, "fm_playerthink", 1);
    set_task(2.0, "display_attack_num", 110477, "", 0, "b");
}


public fm_playerthink(id)
{
        if((pev(id, pev_button) & IN_ATTACK) && !(pev(id, pev_oldbuttons) & IN_ATTACK))
        {
            holding_attack[id] = true;
            g_attack[id]++;
        }
        if((pev(id, pev_oldbuttons) & IN_ATTACK) && !(pev(id, pev_button) & IN_ATTACK))
        {
            holding_attack[id] = false;
        }
}

public display_attack_num()
{
    new playercount, Players[32]
    get_players(Players, playercount,"a")
    for (new i=0; i < playercount; ++i)
    {
        client_print(Players[i], print_chat, "attacks: %d - in-attack: %s", g_attack[Players[i]], holding_attack[Players[i]] ? "true" : "false");
    }
}
__________________

Last edited by regalis; 05-28-2007 at 10:36. Reason: ops...a little bug ;)
regalis is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 05-28-2007 , 16:53   Re: I have 2 questions
Reply With Quote #10

I would use FM_CmdStart instead of FM_PlayerPreThink
_Master_ 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 10:41.


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