AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need some help. [ Not sure where i went wrong. ] (https://forums.alliedmods.net/showthread.php?t=12004)

alfino 04-02-2005 19:30

Need some help. [ Not sure where i went wrong. ]
 
Code:

#include <amxmod>
#include <amxmisc>

public plugin_init()
{
        register_plugin("Random Glow", "1", "Alfred")
        register_cvar("amx_glowdelay","40")
}

new Float:LastGambleTime[33]

public client_connect(id){
        LastGambleTime[id] = -1000.0
        return PLUGIN_CONTINUE
}

public client_disconnect(id){
        LastGambleTime[id] = -1000.0
        return PLUGIN_CONTINUE
}

public HandleSay(id){
        new Speech[192]
        read_args(Speech,192)
        remove_quotes(Speech)
        if(HandleSay2(id,Speech))       
        {
                return PLUGIN_HANDLED
        }
        return PLUGIN_CONTINUE
}

public HandleSay2(id,Speech[])
{
        if ( (equali(Speech, "glow me")) )
        {
                if (get_gametime() < LastGambleTime[id] + get_cvar_float("amx_glowdelay"))
                {
                        client_print(id,print_chat, "[AMXX] <Painter> Hey, i ain't no machine! Let me have some rest!")
                        return PLUGIN_HANDLED
                }
                new User[32]
                get_user_name(id,User,32)
                new Red = random(256)
                new Green = random(256)
                new Blue = random(256)

                set_user_rendering(id,kRenderFxGlowShell, Red, Green, Blue, kRenderNormal,16)
                client_print(id,print_chat, "[AMXX] <Painter> I've painted you.", User)               
                client_print(0,print_chat, "[AMXX] <Painter> Ok, I've painted %s. Next!", User)

        }
        LastGambleTime[id] = get_gametime()
        return PLUGIN_CONTINUE
}

What this plugin, technically, is to paint the user with random colours when he / she says "glow me". When i compile the .sma, there's no error. But somehow, it doesn't work. It shows the plugin as running, but when i type "glow me", nothing happens. Can some one help me?

And btw, i copied those codes from someone. I ain't a good Small programmer, so i took bits and parts from different codes.

xeroblood 04-02-2005 21:25

Re: Need some help. [ Not sure where i went wrong. ]
 
You should include <amxmodx> not <amxmod>
And this:

Quote:

Originally Posted by alfino
Code:

new Red = random(256)
new Green = random(256)
new Blue = random(256)


Should be:
Code:
new Red = random_num(0,256) new Green = random_num(0,256) new Blue = random_num(0,256)

alfino 04-03-2005 03:28

ahh... what was i thinking? :?

thanks! I'll update you guys.

alfino 04-03-2005 06:10

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {    register_plugin("Random Glow", "1", "Alfred")    register_cvar("amx_glowdelay","40") } new Float:LastPaintTime[33] public client_connect(id){    LastPaintTime[id] = -1000.0    return PLUGIN_CONTINUE } public client_disconnect(id){    LastPaintTime[id] = -1000.0    return PLUGIN_CONTINUE } public HandleSay(id){    new Speech[192]    read_args(Speech,192)    remove_quotes(Speech)    return PLUGIN_CONTINUE } public HandleSay2(id,Speech[]) {    if ( (equali(Speech, "glow me")) )    {       if (get_gametime() < LastPaintTime[id] + get_cvar_float("amx_glowdelay"))       {          client_print(id,print_chat, "[AMXX] <Painter> Hey, i ain't no machine! Let me have some rest!")          return PLUGIN_HANDLED       }       new User[32]       get_user_name(id,User,32)       new Red = random_num(0,256)       new Green = random_num(0,256)       new Blue = random_num(0,256)       set_user_rendering(id,kRenderFxGlowShell, Red, Green, Blue, kRenderNormal,16)       client_print(id,print_chat, "[AMXX] <Painter> I've painted you.", User)             client_print(0,print_chat, "[AMXX] <Painter> Ok, I've painted %s. Next!", User)    }    LastPaintTime[id] = get_gametime()    return PLUGIN_CONTINUE }

Same thing, no compile problems, running smoothly. But, when i type glow me, nothing comes out.


All times are GMT -4. The time now is 09:49.

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