AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Weapons Hud Info ! (https://forums.alliedmods.net/showthread.php?t=276096)

abdobiskra 12-15-2015 05:15

[HELP] Weapons Hud Info !
 
Hi !

How do I make the client see the hud message when used a particular weapon?


I tried this ! it works but I want to disappear the hud message when uses another weapon

Is there another way to do this?

Code:
#include <amxmodx> public plugin_init() {     register_clcmd( "weapon_tripmine", "hud_info1" )     register_clcmd( "weapon_357", "hud_info2" )     register_clcmd( "weapon_crossbow", "hud_info3" )     register_clcmd( "weapon_gauss", "hud_info4" )     register_clcmd( "weapon_hornetgun", "hud_info5" )     register_clcmd( "weapon_rpg", "hud_info6" )     register_clcmd( "weapon_snark", "hud_info7" )     register_clcmd( "weapon_9mmAR", "hud_info8" )     register_clcmd( "weapon_crowbar", "hud_info9" )     register_clcmd( "weapon_glock", "hud_info10" )     register_clcmd( "weapon_mp5", "hud_info11" )     register_clcmd( "weapon_handgrenade", "hud_info12" )     register_clcmd( "weapon_egon", "hud_info13" )     register_clcmd( "weapon_shotgun", "hud_info14" )     register_clcmd( "weapon_9mmhandgun", "hud_info15" )         register_event("DeathMsg", "death_event", "a") } public hud_info1(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "Weapon Tripmine^nUse the following Buttons:^n1: MOUSE2 = Laser^n2: E + MOUSE1 = Freeze^n3: E + MOUSE2 = Flash^n4: R + MOUSE2 = Reverse^n5: R + MOUSE1 = Teleport") } public hud_info2(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info3(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info4(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info5(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info6(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info7(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info8(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info9(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info10(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info11(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info12(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info13(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info14(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public hud_info15(id) {     set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)     show_hudmessage(id, "") } public death_event() {   new id = read_data(2)   if(is_user_connected(id))   {       set_hudmessage(102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1)       show_hudmessage(id, "")   } }

abdobiskra 12-16-2015 00:52

Re: [HELP] Weapons Hud Info !
 
i do that also !

but I want to disappear the hud message when uses another weapon ?

Code:
#include <AmxModx> #include <HamSandwich>   public plugin_init() { RegisterHam(Ham_Item_Deploy, "weapon_tripmine", "draw_hud") }   public draw_hud(const tripmine, id) { set_hudmessage(0, 255, 0, 0.75, 0.83, 0, 6.0, 10.0) show_hudmessage(id, "Weapon Tripmine ...bla bla bla !")   return HAM_IGNORED }

NiHiLaNTh 12-16-2015 07:03

Re: [HELP] Weapons Hud Info !
 
Use Ham_Item_Deploy and Ham_Item_Holster for that.

abdobiskra 12-17-2015 10:57

Re: [HELP] Weapons Hud Info !
 
Can you do this? I do not have enough experience in that?

abdobiskra 12-19-2015 02:26

Re: [HELP] Weapons Hud Info !
 
up !

Kakarot47 12-19-2015 08:36

Re: [HELP] Weapons Hud Info !
 
Man when can it will solve

addons_zz 12-19-2015 08:57

Re: [HELP] Weapons Hud Info !
 
Quote:

Originally Posted by abdobiskra (Post 2372557)
but I want to disappear the hud message when uses another weapon

Each HUD has a time out, override your HUD using another with 0.3 time out, for example.

Update:

Do not use names as "hud_info1" for "weapon_tripmine", they are cumbersome. Prefer: "hud_tripmine" for "weapon_tripmine".

Soon I will post a full code.

abdobiskra 12-19-2015 09:30

Re: [HELP] Weapons Hud Info !
 
Quote:

Originally Posted by addons_zz (Post 2373962)
Each HUD has a time out, override your HUD using another with 0.3 time out, for example.

Update:

Do not use names as "hud_info1" for "weapon_tripmine", they are cumbersome. Prefer: "hud_tripmine" for "weapon_tripmine".

Soon I will post a full code.

Im mean when using
Code:

#include <hamsandwich>

addons_zz 12-19-2015 10:03

Re: [HELP] Weapons Hud Info !
 
Quote:

Originally Posted by abdobiskra (Post 2373986)
Im mean when using
Code:

#include <hamsandwich>

This is my ideia, but I cannot test it.

Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #define MAX_NAME_LENGTH       32 #define HUD_PICKUP_CONFIG    102, 102, 32, 0.0, 0.06, 2, 7.0, 10.0, 0.1, 0.1, 1 #define HUD_CHANGE_CONFIG    102, 102, 32, 0.0, 0.06, 2, 7.0, 0.3, 0.1, 0.1, 1 new g_weapons[][MAX_NAME_LENGTH] = {     "weapon_tripmine",     "weapon_357",     "weapon_crossbow",     "weapon_gauss",     "weapon_hornetgun",     "weapon_rpg",     "weapon_snark",     "weapon_hornetgun",     "weapon_rpg",     "weapon_snark",     "weapon_9mmAR",     "weapon_crowbar",     "weapon_glock",     "weapon_mp5",     "weapon_handgrenade",     "weapon_egon",     "weapon_shotgun",     "weapon_9mmhandgun" } public plugin_init() {     new function_name[MAX_NAME_LENGTH]     for( new index = 0; index < sizeof( g_weapons ); index++ )     {         formatex( function_name, charsmax(function_name), "hud_%s", g_weapons[index] )         register_clcmd( g_weapons[index], function_name )         RegisterHam( Ham_Item_Deploy, g_weapons[index], "hide_HUD", 1 )     }     register_event("DeathMsg", "death_event", "a") } public hide_HUD( ent ) {     static id     id = pev( ent, pev_owner )     if( is_user_alive(id) )     {         set_hudmessage( HUD_CHANGE_CONFIG )         show_hudmessage(id, "Changing...")     } } public hud_weapon_tripmine(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "Weapon Tripmine^nUse the following Buttons:^n1: \             MOUSE2 = Laser^n2: E + MOUSE1 = Freeze^n3: E + MOUSE2 = \             Flash^n4: R + MOUSE2 = Reverse^n5: R + MOUSE1 = Teleport") } public hud_weapon_357(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_crossbow(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_gauss(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_hornetgun(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_rpg(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_snark(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_9mmAR(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_crowbar(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_glock(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_mp5(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_handgrenade(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_egon(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_shotgun(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public hud_weapon_9mmhandgun(id) {     set_hudmessage( HUD_PICKUP_CONFIG )     show_hudmessage(id, "") } public death_event() {     new id = read_data(2)     if( is_user_connected(id) )     {         set_hudmessage( HUD_PICKUP_CONFIG )         show_hudmessage(id, "")   } }

abdobiskra 12-19-2015 14:42

Re: [HELP] Weapons Hud Info !
 
addons zz
thx you get me idea

PHP Code:

#include <AmxModx>
#include <HamSandwich>

new weapons[][] = 

//"weapon_tripmine"
"weapon_357"
"weapon_crossbow"
"weapon_gauss"
"weapon_hornetgun"
"weapon_rpg"
"weapon_snark"
"weapon_hornetgun"
"weapon_rpg"
"weapon_snark"
"weapon_9mmAR"
"weapon_crowbar"
"weapon_glock"
"weapon_mp5"
"weapon_handgrenade"
"weapon_egon"
"weapon_shotgun"
"weapon_9mmhandgun" 
}

public 
plugin_init() {

RegisterHam(Ham_Item_Deploy"weapon_tripmine""draw_hud"1)

for(new 
0szcmd[20]; sizeof(weapons); i++)
{
formatex(szcmdcharsmax(szcmd), "%s"weapons[i][0])
register_clcmd(szcmd"hide_HUD")
}
}

public 
hide_HUD(id)
{
set_hudmessage(025500.750.8306.010.0)
show_hudmessage(id"")
}
public 
draw_hud(const tripmineid)
{
    
set_hudmessage(025500.750.8306.010.0)
show_hudmessage(id"Weapon Tripmine ...bla bla bla !")





All times are GMT -4. The time now is 17:57.

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