Raised This Month: $ Target: $400
 0% 

Auto Admin Glow


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jawad Salvad0r
Junior Member
Join Date: Oct 2014
Old 12-05-2014 , 18:16   Auto Admin Glow
Reply With Quote #1

I Want To Turn This Plugin From amx_glow To Auto Admin Glow

Code:
#include <amxmodx>
#include <amxmisc>


#define WhatModule 2 			// 1 = Enable glow via the engine module |  2 = Enable glwo via the fun module
#define LogAdminActions 1		// 0 = No loggin | 1 = Log admin actions
#define PublicGlow 1			// 0 = Public glow code inlcuded | 1 = Public glow code is included.
#define MaxColorCount 7			// Dont change this one.

#if WhatModule == 1
#include <engine>
#else
#include <fun>
#endif

new g_ColorNames[MaxColorCount][12] = { "red","green","blue","yellow","purple","aqua","silver" }
new g_ColorR[MaxColorCount] = { 255,0,0,255,255,0,192 }
new g_ColorG[MaxColorCount] = { 0,255,0,255,0,255,192 }
new g_ColorB[MaxColorCount] = { 0,0,255,0,255,255,192 }

new g_Players[33]	// This array contains the color a player is glowing in. ( if any ) -1 means no color

public plugin_init() 
{ 
	register_plugin("Admin glow","1.3.3","EKS")
	register_concmd("amx_glow","CMD_Glow",ADMIN_KICK,"<nick or #userid> <color>")
	register_concmd("amx_unglow","CMD_UnGlow",ADMIN_KICK,"<nick or #userid>")

#if PublicGlow == 1
	register_clcmd("say /glow","public_glow",0,"say /glow <color>")
	register_clcmd("say /unglow","public_unglow",0,"say /unglow")
	register_cvar("amx_publicglow","1")
#endif
} 

public CMD_Glow(id,level,cid) // This is the funtion called by amx_glow
{ 
	new  VictimName[32],VictimID
	read_argv(1,VictimName,31)  			// This code here reads out the targed.
	VictimID = cmd_target(7,VictimName,32)		// This code here tryes to find out the player index. Either from a nick or #userid
	if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv
	new AdminName[32],Color[12]		// There is no point in starting to make arrays thats not needed, if the above if is true.
	new ColorNR = -1			// This int is made with the value -1 so it can easly be used to check if a valid color has been found & later be used to log what color the admin used.
	read_argv(2,Color,11)
	for(new i = 0;i<MaxColorCount;i++) // This loop is used to check every entry in g_ColorNames
		{
		if (equal(Color,g_ColorNames[i],11))
			{
#if WhatModule == 2
		    set_user_rendering(VictimID,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
#else		    
		    set_rendering(VictimID,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
#endif
			ColorNR = i
			g_Players[VictimID] = i
			}
		}
	if(ColorNR == -1) // If no vaild color has been found, tell the admin and stop the plugin.
		{
		new ColorList[128]
		for(new i = 0;i<MaxColorCount;i++)
			{
			add(ColorList,127,g_ColorNames[i])
			add(ColorList,127," ")	// This is a evil hack, to add spaces.
			}
		console_print(id,"[AMX] %s is not a supported color,vaild colors are:%s",Color,ColorList)
		return PLUGIN_HANDLED
		}
	get_user_name(id,AdminName,31)
	get_user_name(VictimID,VictimName,31)
	switch(get_cvar_num("amx_show_activity"))   { 
   		case 2:   client_print(0,print_chat,"ADMIN %s: has made %s glow %s",AdminName,VictimName,g_ColorNames[ColorNR])
   		case 1:   client_print(0,print_chat,"ADMIN: %s is now glowing %s",VictimName,g_ColorNames[ColorNR])
  	 	}
#if LogAdminActions == 1
	new parm[4] /*0 = Victim id | 1 = Admin id | 2 = Used to control if its a gag or Ungag */
	parm[0] = VictimID
	parm[1] = id
	parm[2] = 0
	parm[3] = ColorNR
	LogAdminAction(parm)
#endif
	return PLUGIN_HANDLED
} 

public CMD_UnGlow(id,level,cid)  // Removed gaged player ( done via console command )
{
	new VictimName[32],AdminName[32],VictimID 
	read_argv(1,VictimName,31) 			// This code here reads out the targed.
	VictimID = cmd_target(7,VictimName,32) 	// This code here tryes to find out the player index. Either from a nick or #userid
	if ((get_user_flags(VictimID) & ADMIN_IMMUNITY) && VictimID != id || !cmd_access (id,level,cid,2) || !VictimID ) { return PLUGIN_HANDLED; } // This code is kind of "long", its job is to. Stop actions against admins with immunity, Stop actions action if the user lacks access, or is a bot/hltv

	get_user_name(id,AdminName,31)
	get_user_name(VictimID,VictimName,31)
	if(g_Players[VictimID] == -1)
		{
		console_print(id,"[AMX] %s is not glowing in any color",VictimName)
		return PLUGIN_HANDLED
		}
#if WhatModule == 2
	set_user_rendering(VictimID,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
#else
	set_rendering(VictimID,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
#endif
	switch(get_cvar_num("amx_show_activity"))   { 
   		case 2:   client_print(0,print_chat,"ADMIN %s: made %s stop glowing %s",AdminName,VictimName,g_ColorNames[g_Players[VictimID]]) 
   		case 1:   client_print(0,print_chat,"ADMIN: %s is no longer glowing %s",VictimName,g_ColorNames[g_Players[VictimID]]) 
  	 	}
	g_Players[VictimID] = -1
#if LogAdminActions == 1
	new parm[4] /*0 = Victim id | 1 = Admin id | 2 = Used to control if its a gag or Ungag */
	parm[0] = VictimID
	parm[1] = id
	parm[2] = 1
	LogAdminAction(parm)
#endif
	return PLUGIN_HANDLED 
} 

#if PublicGlow == 1
public public_glow(id) // This function handels say /glow
{
	if(get_cvar_num("amx_publicglow") == 0)
		{
		client_print(id,3,"[AMX]Public glow is disabled. ")
		return PLUGIN_HANDLED
		}
	new Color[12]
	read_argv(2,Color,31)
	new ColorNR = -1
	for(new i = 0;i<MaxColorCount;i++) // This loop is used to check every entry in g_ColorNames
		{
		if (equal(Color,g_ColorNames[i],11))
			{
#if WhatModule == 2
		    set_user_rendering(id,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
#else		    
		    set_rendering(id,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
#endif
			ColorNR = i
			g_Players[id] = i
			}
		}
	if(ColorNR == -1) // If no vaild color has been found, tell the player and stop the plugin.
		{
		new ColorList[128]
		for(new i = 0;i<MaxColorCount;i++)
			{
			add(ColorList,127,g_ColorNames[i])
			add(ColorList,127," ")	// This is a evil hack, to add spaces.
			}
		client_print(id,3,"[AMX] %s is not a supported color,vaild colors are:%s",Color,ColorList)
		return PLUGIN_HANDLED
		}
	new PlayerName[32]
	get_user_name(id,PlayerName,31)
	set_hudmessage(g_ColorR[ColorNR], g_ColorG[ColorNR], g_ColorB[ColorNR], 0.05, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
	show_hudmessage(id, "%s has made himself glow in %s",PlayerName,Color) 
	return PLUGIN_CONTINUE
}

public public_unglow(id) // This function handels say /unglow
{
	if(get_cvar_num("amx_publicglow") == 0)
		{
		client_print(id,3,"[AMX]Public glow is disabled.")
		return PLUGIN_HANDLED
		}
	if(g_Players[id] == -1)
		{
		client_print(id,3,"[AMX]Your not glowing in any color")
		return PLUGIN_HANDLED
		}
	new PlayerName[32]
#if WhatModule == 2
	set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
#else
	set_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
#endif
	get_user_name(id,PlayerName,31)
	set_hudmessage(g_ColorR[g_Players[id]], g_ColorG[g_Players[id]], g_ColorB[g_Players[id]], 0.05, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
	show_hudmessage(id, "%s has stopped glowing %s",PlayerName,g_ColorNames[g_Players[id]]) 
	g_Players[id] = -1
	return PLUGIN_CONTINUE
}
#endif

#if LogAdminActions == 1
LogAdminAction(parm[]) // This code is what removes the gag.
{ 
	new VictimName[32],AdminName[32],AdminAuth[35],VictimAuth[35]
	get_user_name(parm[1],AdminName,31)
	get_user_name(parm[0],VictimName,31)
	get_user_authid(parm[1],AdminAuth,34)
	get_user_authid(parm[0],VictimAuth,34)

	if(parm[2] == 0)
		log_amx("Glow: ^"%s<%s>^" has made %s <%s> glow %s",AdminName,AdminAuth,VictimName,VictimAuth,g_ColorNames[parm[3]])
	if(parm[2] == 1)
		log_amx("UnGlow: ^"%s<%s>^" has removed the glow from %s<%s>",AdminName,AdminAuth,VictimName,VictimAuth)
}
#endif
public client_connect(id)
{
	g_Players[id] = -1
}
Jawad Salvad0r is offline
Old 12-06-2014, 13:58
Jawad Salvad0r
This message has been deleted by YamiKaitou. Reason: wait 14 days before you bump
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 06-28-2016 , 01:57   Re: Auto Admin Glow
Reply With Quote #2

GO My Profile And See My Post
I Add Post Plugin Admin_Glow ( Auto )
__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
sirerick
Senior Member
Join Date: Jul 2012
Location: Venezuela
Old 06-28-2016 , 10:19   Re: Auto Admin Glow
Reply With Quote #3

like this?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define GLOW_FLAG ADMIN_KICK

const TASK_GLOW 20150

public plugin_init()
{
    
register_plugin("Glow admin""v1.0""Rubio.-")
    
    
RegisterHam(Ham_Spawn"player""Ham_PlayerSpawn_Post"true)
    
RegisterHam(Ham_Killed"player""Ham_PlayerKilled")
}

public 
client_disconnect(id)
{
    
set_user_rendering(id)
    
remove_task(id+TASK_GLOW)
}

public 
Ham_PlayerSpawn_Post(id)
{
    if (!
is_user_alive(id))
        return 
HAM_IGNORED
    
    
if (~get_user_flags(id) & GLOW_FLAG)
        return 
HAM_IGNORED;
    
    
set_task(2.0"SetGlow"id+TASK_GLOW, .flags "b")
    return 
HAM_IGNORED
}

public 
Ham_PlayerKilled(iVictimiAttacker)
{
    if (!
is_user_connected(iAttacker))
        return 
HAM_IGNORED
    
    set_user_rendering
(iVictim)
    
remove_task(iVictim+TASK_GLOW)
    return 
HAM_IGNORED
}

public 
SetGlow(id)
{
    
id -= TASK_GLOW
    set_user_rendering
(idkRenderFxGlowShellrandom_num(0255), random_num(0255), random_num(0255), kRenderNormal15)

sirerick 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 11:30.


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