Raised This Month: $51 Target: $400
 12% 

Join Leave HUD Colors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 06:42   Join Leave HUD Colors
Reply With Quote #1

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.


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
Attached Files
File Type: sma Get Plugin or Get Source (Enter_leave(amxX).sma - 326 views - 2.5 KB)
__________________

Last edited by bmann_420; 02-25-2007 at 07:18.
bmann_420 is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-25-2007 , 06:48   Re: Join Leave HUD Colors
Reply With Quote #2

test this
Attached Files
File Type: sma Get Plugin or Get Source (joinleave.sma - 848 views - 2.7 KB)

Last edited by mateo10; 02-25-2007 at 06:54.
mateo10 is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 07:16   Re: Join Leave HUD Colors
Reply With Quote #3

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.
__________________
bmann_420 is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-25-2007 , 07:33   Re: Join Leave HUD Colors
Reply With Quote #4

Did you try the plugin i posted?
mateo10 is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 07:49   Re: Join Leave HUD Colors
Reply With Quote #5

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 
} 
__________________

Last edited by bmann_420; 02-25-2007 at 08:59.
bmann_420 is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-25-2007 , 09:07   Re: Join Leave HUD Colors
Reply With Quote #6

->
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 
}
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 09:12   Re: Join Leave HUD Colors
Reply With Quote #7

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)

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.
__________________
bmann_420 is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-25-2007 , 09:15   Re: Join Leave HUD Colors
Reply With Quote #8

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
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 09:18   Re: Join Leave HUD Colors
Reply With Quote #9

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
__________________
bmann_420 is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-25-2007 , 09:41   Re: Join Leave HUD Colors
Reply With Quote #10

Re-done from scratch:
Attached Files
File Type: sma Get Plugin or Get Source (enterleave.sma - 768 views - 638 Bytes)
mateo10 is offline
Reply



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 05:19.


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