AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Join Leave HUD Colors (https://forums.alliedmods.net/showthread.php?t=51860)

bmann_420 02-25-2007 06:42

Join Leave HUD Colors
 
1 Attachment(s)
I have this plugin: ( i have modified the code a small amount.

What Im trying todo is leave the basic hud (green, with everyhting including rank/name) for regular people as when they join and leave.
Then when an Admin Shows up, its all red. And its wayyy late and im just ready to give up cause im so tired.

Any help would be much appreciated. :D


Code:

/*
* Cvars:
* amx_enter_message "%name% has joined!\nHave Fun Suka!\n(Rank is %rankpos%,IP:%IP%)"
* amx_leave_message "%name% has left!\nSee Ya Next Time Suka."
*
* If you are using csstats module then you may use
* %rankpos% expression in amx_enter_message cvar.
*
*/

#include <amxmod>
#include <csstats>

#define ADMIN ADMIN_LEVEL_A        // Change to something else if you like.

public client_putinserver(id){
 
  if(is_user_bot(id)) return PLUGIN_CONTINUE;

  new param[34], len
  param[0] = id
  len = get_user_name(id,param[1],31)
  set_task(2.0, "enter_msg", 0, param,len + 2)
  return PLUGIN_CONTINUE
}

public client_disconnect(id){

  new param[34], len
  param[0] = id
  len = get_user_name(id, param[1], 31)
  set_task(2.0, "leave_msg", 0, param, len + 2)
  return PLUGIN_CONTINUE
}

public enter_msg(param[]) {
  new message[192],hostname[64]
  get_cvar_string("amx_enter_message", message, 191)
  get_cvar_string("hostname", hostname, 63)
  replace(message,191, "%hostname%", hostname)
  if (cvar_exists("csstats_reset")){
  new data[8], rankpos[8], pos
  pos = get_user_stats(param[0],data,data)
  numtostr(pos,rankpos,7)
  replace(message, 191, "%rankpos%", rankpos)
  replace(message, 191, "%name%", param[1])
  while(replace(message, 191, "\n", "^n")){}
{
  if(get_user_flags & ADMIN)
{
  set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
  show_hudmessage(0, message)

  else
{
  set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
  show_hudmessage(0, message) 
  return PLUGIN_CONTINUE
}

public leave_msg(param[]) {
  new message[192],hostname[64]
  get_cvar_string("amx_leave_message", message, 191)
  get_cvar_string("hostname", hostname, 63)
  replace(message, 191, "%hostname%", hostname)
  replace(message, 191, "%name%", param[1])
  while(replace(message, 191, "\n", "^n")){}
  set_hudmessage(255, 0, 255, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
  show_hudmessage(0, message)
  return PLUGIN_CONTINUE
}

public plugin_init() {
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China")
  register_cvar("amx_enter_message", "%name% Welcome to |AoC|!\n(Rank is %rankpos%)\nEnjoy Your Stay")
  register_cvar("amx_leave_message", "%name% has left!\nThankx for stoppin in\nwww.armyfochaos.com")
  return PLUGIN_CONTINUE
}

Here is the origional with no screw ups :D

mateo10 02-25-2007 06:48

Re: Join Leave HUD Colors
 
1 Attachment(s)
test this

bmann_420 02-25-2007 07:16

Re: Join Leave HUD Colors
 
HTML Code:

/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(58) : warning 217: loose indentation
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(59) : error 076: syntax error in the expression, or invalid function call
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(71) : warning 217: loose indentation
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(71) : error 029: invalid expression, assumed zero
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(71) : error 017: undefined symbol "leave_msg"
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(83) : warning 225: unreachable code
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(83) : error 029: invalid expression, assumed zero
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(83) : error 004: function "plugin_init" is not implemented
/home/groups/alliedmodders/forums/files/3/9/2/5/14164.attach(89) : error 001: expected token: "}", but found "-end of file-"

6 Errors.
Could not locate output file /home/groups/amxmodx/public_html/compiled3/14164.amx (compile failed).

That is why i was gettin more tired and frustrated.

mateo10 02-25-2007 07:33

Re: Join Leave HUD Colors
 
Did you try the plugin i posted?

bmann_420 02-25-2007 07:49

Re: Join Leave HUD Colors
 
yes it was the one you posted. You must have changed it, cause I compiled it on the online compiler a few minutes ago. (it also says 0 views]

Since now it works, or compiles, havnt tested it yet tho.

EDIT: Tested and perfectly. Thank You. Wich particular digit do you think is the placement tho? I tried looking it up for a minute, but I was tryin to get it on teh same spot on the page. I can look it up and prolly get it soon tho.

The only other thing I wasnt thinking about was message1 and message2. For a different phrase for teh admin, and different cvars.


EDIT:

This is what I want and almsot got it. But I run into this : "home/groups/amxmodx/tmp3/phpsis5wI.sma(56) : error 035: argument type mismatch (argument 1)"
Its the arguements, I just dont know enought :/


HTML Code:

* If you are using csstats module then you may use
* %rankpos% expression in amx_enter_message cvar.
*
*/

#include <amxmod>
#include <csstats>
new g_szSoundFile[] = "buttons/blip1.wav";

public plugin_precache()
{
        precache_sound(g_szSoundFile);
}

public client_putinserver(id){
 
  if(is_user_bot(id)) return PLUGIN_CONTINUE;

  new param[34], len
  param[0] = id
  len = get_user_name(id,param[1],31)
  set_task(2.0, "enter_msg", 0, param,len + 2)
  return PLUGIN_CONTINUE


public enter_msg(param[]) {
  new message[192],hostname[64]
  get_cvar_string("amx_enter_message", message, 191)
  get_cvar_string("hostname", hostname, 63)
  replace(message,191, "%hostname%", hostname)
  if (cvar_exists("csstats_reset")){
      new data[8], rankpos[8], pos
      pos = get_user_stats(param[0],data,data)
      numtostr(pos,rankpos,7)
      replace(message, 191, "%rankpos%", rankpos)
      replace(message, 191, "%name%", param[1])
      while(replace(message, 191, "\n", "^n")){}
      {
        if(get_user_flags(param[0]))
            {
            client_cmd("spk %s", g_szSoundFile);
           
            set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
            show_hudmessage(0, message)
        } 
        else
        {
            set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
            show_hudmessage(0, message) 
        }
      }
  }
}

public plugin_init() {
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China")
  register_cvar("amx_enter_message", "Admin %name% has just joined |AoC|!\n(Rank is %rankpos%)\nSo watch out! =)") 
  return PLUGIN_CONTINUE
}


SAMURAI16 02-25-2007 09:07

Re: Join Leave HUD Colors
 
->
Code:

#include <amxmod>
#include <csstats>
new g_szSoundFile[] = "buttons/blip1.wav";

public plugin_precache()
{
    precache_sound(g_szSoundFile);
}

public client_putinserver(id){
 
  if(is_user_bot(id)) return PLUGIN_CONTINUE;

  new param[34], len
  param[0] = id
  len = get_user_name(id,param[1],31)
  set_task(2.0, "enter_msg", 0, param,len + 2)
  return PLUGIN_CONTINUE


public enter_msg(param[]) {
  new message[192],hostname[64]
  get_cvar_string("amx_enter_message", message, 191)
  get_cvar_string("hostname", hostname, 63)
  replace(message,191, "%hostname%", hostname)
  if (cvar_exists("csstats_reset")){
      new data[8], rankpos[8], pos
      pos = get_user_stats(param[0],data,data)
      numtostr(pos,rankpos,7)
      replace(message, 191, "%rankpos%", rankpos)
      replace(message, 191, "%name%", param[1])
      while(replace(message, 191, "\n", "^n")){}
      {
        if(get_user_flags(param[0]))
        {
            client_cmd(param[0],"spk %s", g_szSoundFile);
       
        set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
            show_hudmessage(0, message)
        } 
        else
        {
            set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
            show_hudmessage(0, message) 
        }
      }
  }
}

public plugin_init() {
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China")
  register_cvar("amx_enter_message", "Admin %name% has just joined |AoC|!\n(Rank is %rankpos%)\nSo watch out! =)") 
  return PLUGIN_CONTINUE
}


bmann_420 02-25-2007 09:12

Re: Join Leave HUD Colors
 
Yes, but you see then you need 2 messages for each client (cvars). As in the Admin his own and teh regulars their own. (Thats expanding it a littl bit) :D

I was just switching around with the enter and leave switching to enter and admin but i can bairly see now, all fuzzy, but for some reason I cant get to sleep.

SAMURAI16 02-25-2007 09:15

Re: Join Leave HUD Colors
 
that plugin it's poor scripted . It's verry simple to make an plugin to make to appear who admin is connecting to server and see him rank, also play a sound

bmann_420 02-25-2007 09:18

Re: Join Leave HUD Colors
 
Well personally im not not that great of a coder to make one from scratch. So I pick up some plugins and make a decent compilation I guess you could say. It works for me since I dont know how to make things from scratch. And they very much well work, just these problems. Or ideas with the problems

mateo10 02-25-2007 09:41

Re: Join Leave HUD Colors
 
1 Attachment(s)
Re-done from scratch:


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

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