AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu with Use (https://forums.alliedmods.net/showthread.php?t=116542)

Linux inside 01-23-2010 22:23

Menu with Use
 
Hey Folks , yeah the Titel of thise Thread is Pretty lame but i realy need help because im not so good at Scripting :P

I want to Create a Menu if A CT presses (+use) on a Terrorist
and then he could do things like Glowing and so on ( for exemple he want to Glow T the id of the T should be saved to an other "public" and the public Function should glow him when The round ends he should be autmaticly unglowed)

Is about Cs 1.6 and i Can t post Snippets because we don t want to make thise Plugin Public . But I realy hope that some can help me .
mfg Linux

Linux inside 01-24-2010 14:08

Re: Menu with Use
 
No one has an Idea ?

wrecked_ 01-24-2010 14:13

Re: Menu with Use
 
1 ) Don't bump before 15 days have passed.

2 ) I'll code you whatever you need tonight once I get home. PM me the details if that's not all you want.

Doc-Holiday 01-24-2010 14:47

Re: Menu with Use
 
Quote:

Originally Posted by wrecked_ (Post 1066010)
1 ) Don't bump before 15 days have passed.

2 ) I'll code you whatever you need tonight once I get home. PM me the details if that's not all you want.

PHP Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>

const m_afButtonPressed 246
const m_afButtonReleased 247

public client_PostThink(id)
{
    if( !
is_user_alive(id) )
    {
        return
    }

    if( 
get_pdata_int(idm_afButtonPressed) & IN_USE )
    {
        
//Display the menu here To get your targets id. Use get_user_aiming
    
}



Linux inside 01-24-2010 16:16

Re: Menu with Use
 
First , Sry i m new in Thise Forum so excuse me when i done something Wrong :P

Second : Thank you for thise help , and i have thougt that i should make it like

PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
g_iMaxPlayers get_maxplayers()
    
register_clcmd("+use""menu")
    
cvar_playerinfo register_cvar("jailbreak_playerinfo""1")
}

public 
menu (id)
{
    if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    } 

but i don t know how get the get_user_aiming to the next function that Glows the Player wich the Ct has Looked at . Any idea ?

Doc-Holiday 01-24-2010 16:44

Re: Menu with Use
 
Quote:

Originally Posted by Linux inside (Post 1066167)
First , Sry i m new in Thise Forum so excuse me when i done something Wrong :P

Second : Thank you for thise help , and i have thougt that i should make it like

PHP Code:

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
g_iMaxPlayers get_maxplayers()
    
register_clcmd("+use""menu")
    
cvar_playerinfo register_cvar("jailbreak_playerinfo""1")
}

public 
menu (id)
{
    if (
cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    } 

but i don t know how get the get_user_aiming to the next function that Glows the Player wich the Ct has Looked at . Any idea ?

The way that mine is set up is Where the comment is it is called when you press the use key.

So try it out. put something like

PHP Code:

get_user_aiming(idtargetbody)
new 
targname[18
get_user_name(idtargname17)
client_print(idprint_chat"You pressed the use key aiming at %s"targname


Exolent[jNr] 01-25-2010 13:36

Re: Menu with Use
 
Code:
#include < amxmodx > #include < engine > #include < cstrike > #include < hamsandwich > new g_hMenu[ 33 ]; new g_iMenuPlayer[ 33 ]; public plugin_init( ) {     RegisterHam( Ham_ObjectCaps, "player", "FwdObjectCaps", 1 ); } public client_disconnect( iPlayer ) {     new hMenu = g_hMenu[ iPlayer ];     if( hMenu ) {         menu_destroy( hMenu );         g_hMenu[ iPlayer ] = 0;     }         g_iMenuPlayer[ iPlayer ] = 0;         for( new i = 1; i < 33; i++ ) {         if( g_iMenuPlayer[ i ] == iPlayer ) {             g_iMenuPlayer[ i ] = 0;         }     } } public FwdObjectCaps( iPlayer ) {     if( ( get_user_button( iPlayer ) & IN_USE )     && cs_get_user_team( iPlayer ) == CS_TEAM_CT ) {         new iEntity, iBody;         get_user_aiming( iPlayer, iEntity, iBody );                 if( is_user_alive( iEntity )         && cs_get_user_team( iEntity ) == CS_TEAM_T ) {             new hMenu = g_hMenu[ iPlayer ];             if( hMenu ) {                 menu_destroy( hMenu );             }                         hMenu = menu_create( "Your Menu", "MenuHandler" );                         menu_additem( hMenu, "Item 1", "1" );             menu_additem( hMenu, "Item 2", "2" );             menu_additem( hMenu, "Item 3", "3" );                         g_hMenu[ iPlayer ] = hMenu;             g_iMenuPlayer[ iPlayer ] = iEntity;                         menu_display( iPlayer, hMenu );         }     } } public MenuHandler( iPlayer, hMenu, iItem ) {     new hCurMenu = g_hMenu[ iPlayer ];     if( !hCurMenu     || hCurMenu != hMenu ) {         return;     }         new iMenuPlayer = g_iMenuPlayer[ iPlayer ];     if( !iMenuPlayer     || cs_get_user_team( iMenuPlayer ) != CS_TEAM_T     || iItem == MENU_EXIT ) {         goto exit_menu;     }         new iAccess, szInfo[ 3 ], hCallback;     menu_item_getinfo( hMenu, iItem, iAccess, szInfo, 2, _, _, hCallback );         switch( str_to_num( szInfo ) ) {         case 1: {             // iPlayer = ct player             // iMenuPlayer = t player                         // pressed item 1         }         case 2: {             // iPlayer = ct player             // iMenuPlayer = t player                         // pressed item 2         }         case 3: {             // iPlayer = ct player             // iMenuPlayer = t player                         // pressed item 3         }     }         exit_menu:     g_hMenu[ iPlayer ] = 0;     g_iMenuPlayer[ iPlayer ] = 0;     menu_destroy( hMenu ); }

Gabriel 01-26-2010 05:22

Re: Menu with Use
 
register_forward(FM_EmitSound, "fwEmitSnd")
Then :
public fwEmitSnd(id, channel, const snd[]){
if(!id || !is_user_connected(id) || !equal(snd,"common/wpn_denyselect.wav")) return

....
}


All times are GMT -4. The time now is 07:19.

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