Raised This Month: $255 Target: $400
 63% 

Notices

some keypress detecting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-19-2018 , 20:30   some keypress detecting
Reply With Quote #1

I'm trying to make some weapon switch related functions.
so I used this
Code:
	register_clcmd("slot1","s1",ADMIN_USER)
	register_clcmd("slot2","s2",ADMIN_USER)
	register_clcmd("slot3","s3",ADMIN_USER)
	register_clcmd("slot4","s4",ADMIN_USER)
	register_clcmd("slot5","s5",ADMIN_USER)
but it seems that none of the functions worked.
what's wrong here?
__________________

Last edited by man_s_our; 03-19-2018 at 20:31.
man_s_our is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Old 03-20-2018 , 01:26   Re: some keypress detecting
Reply With Quote #2

what is s1 and how can it trigger slot1?
__________________
Ban dexter permanently. here is his "steam-only" server community with an exception for non-steam players to join. http://usercs.net/
also he's an idiot.
DjSoftero is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-20-2018 , 04:45   Re: some keypress detecting
Reply With Quote #3

Quote:
Originally Posted by DjSoftero View Post
what is s1 and how can it trigger slot1?
sn are the functions that must be done when player choose slotn
__________________
man_s_our is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Old 03-20-2018 , 05:00   Re: some keypress detecting
Reply With Quote #4

yeah, sorry I forgot how the function works. thought I might have been onto something
__________________
Ban dexter permanently. here is his "steam-only" server community with an exception for non-steam players to join. http://usercs.net/
also he's an idiot.
DjSoftero is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 03-20-2018 , 06:26   Re: some keypress detecting
Reply With Quote #5

Show the full code
__________________
@Jailbreak API MODE 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !

@Arena Mod 90% done !


Donate for more
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old 03-20-2018, 06:40
man_s_our
This message has been deleted by man_s_our.
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-20-2018 , 07:52   Re: some keypress detecting
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
Show the full code
PHP Code:
#include <amxmodx> 
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.6" 

const HUD_HIDE_CAL 1<<0
const HUD_HIDE_FLASH 1<<1
const HUD_HIDE_ALL 1<<2    
const HUD_HIDE_RHA 1<<3
const HUD_HIDE_TIMER 1<<4
const HUD_HIDE_MONEY 1<<5
const HUD_HIDE_CROSS 1<<6
const HUD_DRAW_CROSS 1<<7

const HIDE_GENERATE_CROSSHAIR HUD_HIDE_FLASH|HUD_HIDE_RHA|HUD_HIDE_TIMER|HUD_HIDE_MONEY|HUD_DRAW_CROSS

#define    m_iHideHUD            361
#define    m_iClientHideHUD        362
#define    m_pClientActiveItem        374

enum _:Hide_Hud {
    
Hide_Cal,
    
Hide_Flash,
    
Hide_All,
    
Hide_Rha,
    
Hide_Timer,
    
Hide_Money,
    
Hide_Cross,
    
Draw_Cross
}

new 
g_bitHudFlags

new g_pCvars[Hide_Hud]

public 
plugin_init() 

    
register_plugin("HUD Customizer"VERSION"Igoreso/ConnorMcLeod"
    
    
g_pCvars[Hide_Cal] = 0
    g_pCvars
[Hide_Flash] = 0
    g_pCvars
[Hide_All] = 1
    g_pCvars
[Hide_Rha] = 0
    g_pCvars
[Hide_Timer] = 0
    g_pCvars
[Hide_Money] = 0
    g_pCvars
[Hide_Cross] = 0
    g_pCvars
[Draw_Cross] = 0

    register_clcmd
("slot1","s1")
    
register_clcmd("slot2","s2")
    
register_clcmd("slot3","s3")
    
register_clcmd("slot4","s4")
    
register_clcmd("slot5","s5")

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
register_event("ResetHUD""Event_ResetHUD""b")
    
register_event("HideWeapon""Event_HideWeapon""b")

    
Event_HLTV_New_Round()
}
public 
s1(id,level,cid){
    
client_cmd(id"weapon_p228");
    
client_cmd(id"weapon_scout");
    
client_cmd(id"weapon_xm1014");
    
client_cmd(id"weapon_mac10");
    
client_cmd(id"weapon_aug");
    
client_cmd(id"weapon_ump45");
    
client_cmd(id"weapon_sg550");
    
client_cmd(id"weapon_galil");
    
client_cmd(id"weapon_famas");
    
client_cmd(id"weapon_awp");
    
client_cmd(id"weapon_mp5navy");
    
client_cmd(id"weapon_m249");
    
client_cmd(id"weapon_m3");
    
client_cmd(id"weapon_m4a1");
    
client_cmd(id"weapon_tmp");
    
client_cmd(id"weapon_g3sg1");
    
client_cmd(id"weapon_sg552");
    
client_cmd(id"weapon_ak47");
    
client_cmd(id"weapon_p90");
}
public 
s2(id,level,cid){
    
client_cmd(id"weapon_elite");
    
client_cmd(id"weapon_fiveseven");
    
client_cmd(id"weapon_usp");
    
client_cmd(id"weapon_glock18");
    
client_cmd(id"weapon_deagle");
}
public 
s3(id,level,cid){
    
client_cmd(id"weapon_knife");
}
public 
s4(id,level,cid){
    
client_cmd(id"weapon_hegrenade");
    
client_cmd(id"weapon_smokegrenade");
    
client_cmd(id"weapon_flashbang");
}
public 
s5(id,level,cid){
    
client_cmd(id"weapon_c4");
}
public 
Event_HLTV_New_Round()
{
    for(new 
ii<Hide_Hudi++)
    {
        if(
g_pCvars[i])
        {
            
g_bitHudFlags |= 1<<i
        
}
    }
}

public 
Event_ResetHUD(id)
{
    if( 
g_bitHudFlags )
    {
        
set_pdata_int(idm_iClientHideHUD0)
        
set_pdata_int(idm_iHideHUDg_bitHudFlags)
    }    
}

public 
Event_HideWeaponid )
{
    new 
iFlags read_data(1)
    if( 
g_bitHudFlags && (iFlags g_bitHudFlags != g_bitHudFlags) )
    {
        
set_pdata_int(idm_iClientHideHUD0)
        
set_pdata_int(idm_iHideHUDiFlags|g_bitHudFlags)
    }
    if( 
iFlags HIDE_GENERATE_CROSSHAIR && !(g_bitHudFlags HUD_DRAW_CROSS) && is_user_alive(id) )
    {
        
set_pdata_cbase(idm_pClientActiveItemFM_NULLENT)
    }
}
public 
show_huds(){
    
g_pCvars[Hide_Cal] = 1
    g_pCvars
[Hide_Flash] = 1
    g_pCvars
[Hide_All] = 0
    g_pCvars
[Hide_Rha] = 1
    g_pCvars
[Hide_Timer] = 1
    g_pCvars
[Hide_Money] = 1
    g_pCvars
[Hide_Cross] = 1
    g_pCvars
[Draw_Cross] = 0
}
public 
hide_huds(){
    
g_pCvars[Hide_Cal] = 0
    g_pCvars
[Hide_Flash] = 0
    g_pCvars
[Hide_All] = 1
    g_pCvars
[Hide_Rha] = 0
    g_pCvars
[Hide_Timer] = 0
    g_pCvars
[Hide_Money] = 0
    g_pCvars
[Hide_Cross] = 0
    g_pCvars
[Draw_Cross] = 0

the last 2 functions are made to be APIs so that the choosing menus can apear.
__________________

Last edited by man_s_our; 03-20-2018 at 07:54.
man_s_our is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-20-2018 , 10:15   Re: some keypress detecting
Reply With Quote #7

You can't hook the slot commands like that.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-20-2018 , 10:26   Re: some keypress detecting
Reply With Quote #8

Quote:
Originally Posted by OciXCrom View Post
You can't hook the slot commands like that.
how to do this?
__________________
man_s_our is offline
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 03-20-2018 , 20:46   Re: some keypress detecting
Reply With Quote #9

I've founde the way to do that.
by hooking othe console cmds and asking users to bind keys for it.
but I found a problem in setting API so I'll let it for other time.
__________________

Last edited by man_s_our; 03-20-2018 at 21:12.
man_s_our is offline
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 01:47.


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