AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP!! Admin Glow - modified EKS Version (https://forums.alliedmods.net/showthread.php?t=2817)

firewalker877 06-17-2004 20:21

HELP!! Admin Glow - modified EKS Version
 
1 Attachment(s)
The following is a slightly modified admin glow by EKS, whom i give all the credit.

Ok heres the problem. Admin glow has two different types of commands. The admin's console commands and public client commands. I was unable to get the client commands to work with EKS's original version, as were many others. IWe can't really get any help from the creator, so I've tried workin on it myself. The admin commands are fine. I cleaned up the code a bit to cut down on confusion. The original had quite a few if statements that were used to check the cvar that toggled client commands on and off and a few functions used to log activity. These are no longer in the code that follows.

With the following sma, the public command "say unglow" is fully functional and is acting as it should. However, I am having trouble with the public glow command. If the user types "glow red" in game, nothing happens, but if the user types "say glow red" in the console, the function is called and the user begins to glow. How can I make it so that typing "glow red" in game calls the function and sets the user rendering, and typing "say glow red" in console does nothing???????

The code is much easier to read without the wrap. You might copy it to WordPad. Just a thought.

THANKS!!!

Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define MaxColorCount 8                                        // Dont change this one.

new g_ColorNames[MaxColorCount][12] = { "red","orange","yellow","green","aqua","blue","purple","white" }
new g_ColorR[MaxColorCount] = { 255, 255, 255,  0,  0,  0, 255, 192 }
new g_ColorG[MaxColorCount] = {  0, 140, 255, 255, 255,  0,  0, 192 }
new g_ColorB[MaxColorCount] = {  0,  0,  0,  0, 255, 255, 255, 192 }
new g_Players[33]


public plugin_init()
        {
        register_plugin("Admin glow","1.3.1","EKS")
        register_concmd("amx_glow","CMD_Glow",ADMIN_KICK,"<nick or #userid> <color>")
        register_concmd("amx_unglow","CMD_UnGlow",ADMIN_KICK,"<nick or #userid>")
        register_clcmd("glow","public_glow",0,"say glow <color>")
        register_clcmd("say unglow","public_unglow",0,"say unglow")
        }

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 tries 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))
                        {
                        set_user_rendering(VictimID,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
                        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])
                  }
        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 reads out the target.
        VictimID = cmd_target(7,VictimName,32)        // This code tries 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
                }
       
        set_user_rendering(VictimID,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
        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
        return PLUGIN_HANDLED
        }

public public_glow(id)                                        // This function handles say glow
        {
        new PlayerName[32]
        get_user_name(id,PlayerName,31)
        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))
                        {
                        set_user_rendering(id,kRenderFxGlowShell,g_ColorR[i],g_ColorG[i],g_ColorB[i],kRenderNormal,25)
                        ColorNR = i
                        g_Players[id] = 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
                }
        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 handles say unglow
        {
        new PlayerName[32]
        get_user_name(id,PlayerName,31)
        if(g_Players[id] == -1)
                {
                client_print(id,3,"[AMX]Youre not glowing")
                return PLUGIN_HANDLED
                }

        set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25)
        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
        }

public client_connect(id)
        {
        g_Players[id] = -1
        }


FroXeN 06-18-2004 19:11

why dont you release it on the plugins then.. as EKS MODIFIED GLOW 8) sounds like race cars

QwertyAccess 06-19-2004 01:07

Quote:

Originally Posted by FroXeN
why dont you release it on the plugins then.. as EKS MODIFIED GLOW 8) sounds like race cars

Didnt you even read his post. hes having a problem with people not being able to say glow red and things, i doubt anyone in the right mind would release a barely modified plugin, especially one that doesnt work. and also what mod are you trying to do say glow red on?


All times are GMT -4. The time now is 14:48.

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