Raised This Month: $ Target: $400
 0% 

+use triggering action. (HOW?)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TiToTal
Member
Join Date: Feb 2006
Old 03-09-2009 , 00:12   +use triggering action. (HOW?)
Reply With Quote #1

I just want to know how to do a simple code...
I want to, when someone press de "+use" buttom (E default), I get something doing...

For example, when someone press E, and if he is near some entity, then he is going to die...

Thank you ;)


EDIT: It's for The Specialists mod!

Last edited by TiToTal; 03-09-2009 at 21:25.
TiToTal is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 03-09-2009 , 00:31   Re: A simple question...
Reply With Quote #2

PHP Code:
register_clcmd"+use""CommandUse" )

public 
CommandUseid )
{
    
// Your actions

TheRadiance is offline
Send a message via ICQ to TheRadiance
zwfgdlc
Senior Member
Join Date: May 2006
Old 03-09-2009 , 11:36   Re: A simple question...
Reply With Quote #3

look this.
http://forums.alliedmods.net/showthread.php?t=86213
zwfgdlc is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-09-2009 , 12:52   Re: A simple question...
Reply With Quote #4

You would have to hook FM_CmdStart and then check for with button the player press.
I suggest you to edit your title to be more explicit about your request.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
TiToTal
Member
Join Date: Feb 2006
Old 03-09-2009 , 21:12   Re: +use triggering action. (HOW?)
Reply With Quote #5

wait wait... ( I changed the topic title... sorry for not being explicit )

Wait... I didn't got it yet... What code do I have actually to do?

I tried:

Code:
register_clcmd( "+use", "CommandUse" ) 

public CommandUse( id ) 
{ 
    // Your actions 
}
but it didn't work...
TiToTal is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-09-2009 , 22:17   Re: +use triggering action. (HOW?)
Reply With Quote #6

For example, this thing I whipped up in literally like ten seconds will kill someone when they are if the water. It probably doesn't work, but it is just an example.

PHP Code:
public CommandUseid 
{
    if(
pev(idpev_flags) & FL_INWATER)
    {
        
user_killid )
        
    } 
    else
    {
        
// do nothing
    
}
    return 
PLUGIN_HANDLED

BOYSplayCS is offline
TiToTal
Member
Join Date: Feb 2006
Old 03-10-2009 , 13:18   Re: +use triggering action. (HOW?)
Reply With Quote #7

but is this code activated by +use button?


I got my function working already, all I want to know is how to get it triggered by +use button (E default)
TiToTal is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 03-10-2009 , 13:52   Re: +use triggering action. (HOW?)
Reply With Quote #8

PHP Code:
public client_prethink(id)
{
    if (
pev(id,pev_button) & IN_USE)
    {
          
// Your actions
    
}

__________________

padilha007 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-10-2009 , 15:50   Re: +use triggering action. (HOW?)
Reply With Quote #9

This is the best way to detect button usage:
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_forward(FM_CmdStart, "FwdCmdStart"); } public FwdCmdStart(client, uc_handle, seed) {     new button = get_uc(uc_handle, UC_Buttons);         // how to block a button:     if( button & IN_USE )     {         button &= ~IN_USE;         set_uc(uc_handle, UC_Buttons, button);                 return FMRES_SUPERCEDE;     }         return FMRES_IGNORED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
TiToTal
Member
Join Date: Feb 2006
Old 03-10-2009 , 19:10   Re: +use triggering action. (HOW?)
Reply With Quote #10

THANK YOOOOOOOOUUUU

I am gonna test it 'till tomorrow... I appreciate your help.. ;)
Thanks for helping a newbie... lol =)

I am considering to study "programming" ( I don't know how I should say this in english.)
Anyway.

Thanks for your help guys... I am gonna +karma you ;)
TiToTal 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 08:54.


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