Raised This Month: $ Target: $400
 0% 

Get Button ID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 10-08-2010 , 20:46   Get Button ID
Reply With Quote #1

1. How i can get the Button IDs from a Button in a CS 1.6 Map?

best is when i aim at it and i write /info and it shows me the button id

2. and how i can aktivate the Button over the Plugin over a clcmd


GreeTz from Me
__________________

Some People brings Happynes by Coming
Some by Going
Stylaa is offline
Send a message via ICQ to Stylaa
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 10-08-2010 , 21:33   Re: Get Button ID
Reply With Quote #2

1.
Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_clcmd( "say /info", "CmdInfo" ) } public CmdInfo( id ) {     new ent, aim     get_user_aiming( id, ent, aim )         if( ent )     {         new cname[32]         entity_get_string( ent, EV_SZ_classname, cname, 31 )                 if( equal( cname, "func_button" ) )         {             client_print( id, print_chat, "Button ID: %d", ent )         }     } }

2.
Code:
dllfunc( DLLFunc_Use, buttonid, userid )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 10-09-2010 , 09:00   Re: Get Button ID
Reply With Quote #3

THanks this works Great

And how can i get the event Player Uses a Button?
I want to show a msg if the Player for example presses button id 50


But Dynamic like that


Register Button Press

id = Pressedbutton

if id = 50 then
Colorchat ... Message
else if id = 45
Colorchat ... Message
__________________

Some People brings Happynes by Coming
Some by Going

Last edited by Stylaa; 10-09-2010 at 09:04.
Stylaa is offline
Send a message via ICQ to Stylaa
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-09-2010 , 09:47   Re: Get Button ID
Reply With Quote #4

should work

PHP Code:
public plugin_init()
{
    
RegisterHam(Ham_Use"func_button""fwdButtonUse");
}

public 
fwdButtonUse(entid)
{
    
//id = index of player who pressed the button
    //ent = entity index of the button
    
    
switch(ent)
    {
         case 
50: { /* Stuff here */ }
         case 
45: { /* Stuff here */ }
    }

__________________

Last edited by minimiller; 10-09-2010 at 14:25. Reason: Fixed
minimiller is offline
Send a message via MSN to minimiller
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 10-09-2010 , 13:58   Re: Get Button ID
Reply With Quote #5

Quote:
Originally Posted by minimiller View Post
should work

PHP Code:
public plugin_init()
{
    
RegisterHam(Ham_Use"func_button""fwdButtonUse");
}

public 
fwdButtonUse(ident)
{
    
//id = index of player who pressed the button
    //ent = entity index of the button
    
    
switch(ent)
    {
         case 
50: { /* Stuff here */ }
         case 
45: { /* Stuff here */ }
    }


doesent work
I think its a button id dont must it be anythink like

as

case"func_button 50"

?

GreeTz
__________________

Some People brings Happynes by Coming
Some by Going
Stylaa is offline
Send a message via ICQ to Stylaa
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 14:02   Re: Get Button ID
Reply With Quote #6

Quote:
Originally Posted by Stylaa View Post
doesent work
I think its a button id dont must it be anythink like

as

case"func_button 50"

?

GreeTz
No, his code is right.
Make sure you have the correct button ids.

Code:
#include < amxmodx > #include < hamsandwich > public plugin_init( ) {     RegisterHam( Ham_Use, "func_button", "FwdUseButton" ); } public FwdUseButton( iEntity, iPlayer, iActivator, iUseType, Float:flValue ) {     if( !is_user_alive( iPlayer )     ||  iUseType != 2     ||  flValue != 1.0 )     {         return HAM_IGNORED;     }         client_print( iPlayer, print_chat, "Button Entity: %i", iEntity );         return HAM_IGNORED; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 10-09-2010 , 14:08   Re: Get Button ID
Reply With Quote #7

Heres my Code

and the Button IDs are 100 % Correct and it doesnt work

PHP Code:
public plugin_init()
{
    ....
    
RegisterHam(Ham_Use"func_button""fwdButtonUse");
    ....
}


public 
fwdButtonUse(ident)
{
    
//id = index of player who pressed the button
    //ent = entity index of the button
    
    
new mapname[33]
    
get_mapname(mapname32)
    
    new 
PlayerName[32]
    
    
get_user_name(idPlayerName31)

if (
equali(mapname,"jb_mania_fixed"))
    {
        
        switch(
ent)
        {
            case 
290:
            {
                
ColorChat(0RED"%s %L",PREFIXLANG_SERVER,"KZ_DONE"PlayerName )
            }
            case 
291:
            {
                
ColorChat(0RED"%s %L",PREFIXLANG_SERVER,"KZ_DONE"PlayerName )
            }

        }
    }
    

__________________

Some People brings Happynes by Coming
Some by Going

Last edited by Stylaa; 10-09-2010 at 14:13.
Stylaa is offline
Send a message via ICQ to Stylaa
lazarev
Veteran Member
Join Date: Sep 2008
Old 10-09-2010 , 14:19   Re: Get Button ID
Reply With Quote #8

PHP Code:
public plugin_init()
{
    new 
mapname[33]
    
get_mapname(mapname32)
    
    if (
equali(mapname,"jb_mania_fixed"))
    {
        
RegisterHam(Ham_Use"func_button""fwdButtonUse");
    }
}


public 
fwdButtonUse(entid)
{
    new 
PlayerName[33]
    
    
get_user_name(idPlayerName32)
        
    switch(
ent)
    {
        case 
290:
        {
            
ColorChat(0RED"%s %L",PREFIXLANG_SERVER,"KZ_DONE"PlayerName )
        }
        case 
291:
        {
            
ColorChat(0RED"%s %L",PREFIXLANG_SERVER,"KZ_DONE"PlayerName )
        }
    }



Last edited by lazarev; 10-09-2010 at 14:21.
lazarev is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 10-09-2010 , 14:25   Re: Get Button ID
Reply With Quote #9

my bad
i got the params in fwdButtonUse the wrong way round
__________________
minimiller is offline
Send a message via MSN to minimiller
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 10-09-2010 , 15:09   Re: Get Button ID
Reply With Quote #10

okay thanks everythink is working well now
__________________

Some People brings Happynes by Coming
Some by Going
Stylaa is offline
Send a message via ICQ to Stylaa
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 10:26.


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