AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]Hud problems. (https://forums.alliedmods.net/showthread.php?t=40949)

Xum 07-06-2006 16:19

[solved]Hud problems.
 
How can i make a hudmsg to be seen every round, without disapearing from screen.

Rolnaaba 07-06-2006 17:03

Re: Hud problems.
 
Code:

/* Show HUD Message */
#include <amxmodx></p>
#include <amxmisc></p>
#define PLUGIN "Show Hud Message"</p>
#define VERSION "1.0"</p>
#define AUTHOR "Rolnaaba"</p>
 
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public startround(id)
{
  set_hudmessage(0, 0, 255, -1.0, -1.0, 0, 6.0, 12.0)
  show_hudmessage(id, "YOUR TEXT HERE")
  set_task(0.2, "show_hudmsg")
}
public show_hudmsg(id)
{
 set_hudmessage(0, 0, 255, -1.0, -1.0, 0, 6.0, 12.0)
 show_hudmessage(id, "YOUR TEXT HERE")
 set_task(0.2, "show_hudmsg")
}

just change YOUR TEXT HERE to w/e you want (make sure to have both YOUR TEXT HERE messages the same

Xum 07-06-2006 17:33

Re: Hud problems.
 
Code:
// Credits to Gizmo #include <amxmodx> #include <amxmisc>  new argMessage[256]          public plugin_init()  {     register_plugin("HUDmsg", "1.0", "Hip_hop_x")       register_cvar("sv_hudmsg", "1", 0)       register_concmd("amx_hudcenter", "cmd_message", ADMIN_CHAT, "message in the center")         register_concmd("amx_hudmsg", "cmd_extrem", ADMIN_ALL, "<message up>")        }    public startround(id) {      if(get_cvar_num("sv_hudmsg") == 0){ return PLUGIN_HANDLED         } set_task(2, argMessage)     }        public cmd_message (id)  {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                     read_args(argMessage, 255)         set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, argMessage) return PLUGIN_HANDLED }  public cmd_extrem(id) {         if(!access(id, ADMIN_CHAT)) {                 console_print(id, "[AMXX] You have no access to this command!");             return PLUGIN_HANDLED           }               read_args(argMessage, 255)     set_hudmessage(150, 89, 37, -1.0, 0.10, 0, 1.0, 999991.0, 0.1, 0.2, -1)         show_hudmessage(0, argMessage)       return PLUGIN_HANDLED  }        public recl(id)     {         console_print(id, "[Xu Message] For more plugins vizit xu-share.tk")     }    public client_connect(id)  {      new name[18]     get_user_name(id, name, 17)      if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 21.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s connecting", name)     } } public     client_disconnect(id) {     new name[18]     get_user_name(id, name, 17)         if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 21.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s has disconnected", name)     } }


If i die i can't see the message.

Rolnaaba 07-07-2006 11:02

Re: Hud problems.
 
because you never defined for the message to say when ur dead:
Code:
register_event("DeathMsg", "DeathMsg", "a")   public DeathMsg { //message code here }

also add this to plugin init i forgot to type it on my post:
Code:
register_event("ResetHUD", "startround", "be")

Xum 07-07-2006 12:28

Re: Hud problems.
 
thx

Zenith77 07-07-2006 12:45

Re: Hud problems.
 
The ResetHud event is called on when a person spawns, not every round. Use register_logevent(). Although, the end result will usually be the same, some other plugin may force people to spawn early or something else, causing the message to be displayed every spawn.

*edit*
Why in the world do you have a message to v3x ("v3x Check your PM's!") in your sig rolnaaba

Rolnaaba 07-07-2006 12:47

Re: Hud problems.
 
reset hud wwill show it when they spawn and then when they die it goes away so retype it n the deathmsg problem solved...

kalhimeo 07-19-2006 21:32

Re: [solved]Hud problems.
 
--- EDIT --- problem solved :)

Hi,

i m a beginner in AMX MOD X scripting but i succeded in some commands :)

Basicly, i send an HUD to different players based on steamid or to evey players (@all or @ct or @t) and i would like tho make the HUD stay after "spawn" and "death".

The difference from the sample above is that the messages that i send are different depending of the target (player). Also it should not re-send the HUD when the HUD has a timer (i consider 9999 as infinite timer, other timers shouldn't re-send the HUD)

Here is my (updated) code
Code:


new msaymsg[33]

public plugin_init()
{
  register_plugin(PLUGIN, VERSION, AUTHOR)
  register_srvcmd("amx_msay","cmd_msay")
  register_event("ResetHUD", "evnt_resethud", "be")
  register_event("DeathMsg", "evnt_deathmsg", "a")
}

public cmd_msay(id, level, cid)
{
  new sw1tch[11]
  read_argv(1, sw1tch, 10)
  if (sw1tch[0] == '@')
  {
    new arg4[5]
    read_argv(2, arg4, 4)
    new arg0[300]
    read_args(arg0, 299)
    new length = strlen(sw1tch) + strlen(arg4) + 2
    remove_quotes(arg0[length])
    new players[32]
    new player,num,i
    if (equali(sw1tch[1], "CT"))
    {
      get_players(players,num,"ceh","CT")
    } else if (equali(sw1tch[1], "T")) {
      get_players(players,num,"ceh","TERRORIST")
    } else if (equali(sw1tch[1], "ALL")) {
      get_players(players,num,"ch")
    }
    new message[552]
    format(message,551,"%s",arg0[length])
    replace_all(message,551,"%n","\n")
    replace_all(message,551,"\n","^n")
    if(equali(arg4, "0"))
    {
      arg4 = "9999"
    }
    new Float:time = floatstr(arg4)
    set_hudmessage(255,255,255,0.01,0.33,0,time,time,0.01,0.01,1)
    for(i=0;i<num;i++)
    {
      player = players[i]
      if(!is_user_connected(player)) continue
      else if(player)
      {
        if (equali(arg4, "9999"))
        {
          msaymsg[player] = message
        } else {
          msaymsg[player] = "0"
        }
        show_hudmessage(player,message)
      }
    }
    server_print("MSAY to %s: ^"%s^"",sw1tch,message)
  } else {
    new arg1[8]
    new arg2[16]
    new arg3[16]
    read_argv(1, arg1, 7)
    read_argv(3, arg2, 15)
    read_argv(5, arg3, 15)
    new target[35]
    format(target,34,"%s:%s:%s",arg1,arg2,arg3)
    new arg4[5]
    read_argv(6, arg4, 4)
    new arg0[300]
    read_args(arg0, 299)
    new length = strlen(target) + strlen(arg4) + 2
    remove_quotes(arg0[length])
    new targetuser = find_player("chj",target)
    if(!is_user_connected(targetuser))
    {
      return PLUGIN_HANDLED
    }
    new message[552]
    format(message,551,"%s",arg0[length])
    replace_all(message,551,"%n","\n")
    replace_all(message,551,"\n","^n")
    if(equali(arg4, "0"))
    {
      arg4 = "9999" 
      msaymsg[targetuser] = message
    } else {
      msaymsg[targetuser] = "0"
    }
    new Float:time = floatstr(arg4)
    set_hudmessage(255,255,255,0.01,0.33,0,time,time,0.01,0.01,1)
    show_hudmessage(targetuser,message)
    server_print("MSAY to %s: ^"%s^"",target,message)   
  }
  return PLUGIN_HANDLED
}

public evnt_resethud(id)
{
  set_hudmessage(255,255,255,0.01,0.33,0,9999.0,9999.0,0.01,0.01,1)
  if(!equali(msaymsg[id], "0"))
  {
    show_hudmessage(id,msaymsg[id])
  }
}


public evnt_deathmsg()
{
  new id = read_data(2)
  set_hudmessage(255,255,255,0.01,0.33,0,9999.0,9999.0,0.01,0.01,1)
  if(!equali(msaymsg[id], "0"))
  {
    show_hudmessage(id,msaymsg[id])
  }
}


public client_connect(id)
{
  msaymsg[id] = "0"
}

public client_disconnect(id)
{
  msaymsg[id] = "0"
}



All times are GMT -4. The time now is 08:05.

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