AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Random Colour (https://forums.alliedmods.net/showthread.php?t=95371)

ƒa†es™ 06-23-2009 03:30

Random Colour
 
Is there anyway that i can keep switching the Glow color ?

Like this:

PHP Code:

fm_set_rendering(idkRenderFxGlowShell02250kRenderNormal16)
fm_set_rendering(idkRenderFxGlowShell00225kRenderNormal16)

fm_set_rendering(idkRenderFxGlowShell22500kRenderNormal16

Like keep switching the glow colour.

minimiller 06-23-2009 04:07

Re: Random Colour
 
set a repeating task then
Code:

switch(random_num(0,3))
{
    case 0:
    {
          set_rendering();
    }
    case 1:
    {
          set_rendering();
    }
    case 2:
    {
          set_rendering();
    }
    case 3:
    {
          set_rendering();
    }
}

you get the idea

ƒa†es™ 06-23-2009 04:21

Re: Random Colour
 
Quote:

Originally Posted by minimiller (Post 854750)
set a repeating task then
Code:

switch(random_num(0,3))
{
    case 0:
    {
          set_rendering();
    }
    case 1:
    {
          set_rendering();
    }
    case 2:
    {
          set_rendering();
    }
    case 3:
    {
          set_rendering();
    }
}

you get the idea


How do i set repeating task ?

xPaw 06-23-2009 04:37

Re: Random Colour
 
http://www.amxmodx.org/funcwiki.php?...task&go=search

ƒa†es™ 06-23-2009 05:16

Re: Random Colour
 
Quote:

Originally Posted by xPaw (Post 854760)

I don't understand it.

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init() 
{
 
register_plugin("Testing","1.0","ƒa†es™")
}

public 
client_connect(id)
{
        
set_task(1.0,"Rainbow",id,"",0,"b"
}

public 
Rainbow(id)
{
      switch(
random_num(1,3))
      {
            case 
1:
            {
                  
fm_set_rendering(idkRenderFxGlowShell22500kRenderNormal16)
            }
            case 
2:
            {
                  
fm_set_rendering(idkRenderFxGlowShell02250kRenderNormal16)
            }
            case 
3:
            {
                  
fm_set_rendering(idkRenderFxGlowShell00225kRenderNormal16)
            }
 
      }
}
stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 255
{
 new 
Float:RenderColor[3]
 
RenderColor[0] = float(r)
 
RenderColor[1] = float(g)
 
RenderColor[2] = float(b)
 
set_pev(entitypev_renderfxfx)
 
set_pev(entitypev_rendercolorRenderColor)
 
set_pev(entitypev_rendermoderender)
 
set_pev(entitypev_renderamtfloat(amount))
 return 
1


This work.

The problem i can't seem to do it at menu.

Can someone show me the correct way of doing it in menu ?

minimiller 06-23-2009 05:54

Re: Random Colour
 
what do u mean "in menu"?
like you can select your own colors...?

ƒa†es™ 06-23-2009 06:15

Re: Random Colour
 
Quote:

Originally Posted by minimiller (Post 854806)
what do u mean "in menu"?
like you can select your own colors...?

Meaning that using repeat task on menu

Example:

PHP Code:

GlowMenu(id)
{
    new 
menu menu_create("\rGlow Menu""glowmenu_handler")
    
menu_additem(menu"\wRed""1"0)
    
menu_additem(menu"\wGreen""2"0)
    
menu_additem(menu"\wBlue""3"0)
    
menu_additem(menu"\wYellow""4"0)
    
menu_additem(menu"\wLight Blue""5"0)
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
glowmenu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu)
        if( 
is_user_connected(id))
            
AMX_Menu(id)
        return 
PLUGIN_HANDLED
    
}

    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    new 
key str_to_num(data)
    switch(
key)
    {
        case 
1:
        {
            
fm_set_rendering(idkRenderFxGlowShell22500kRenderNormal16)
            
client_print(idprint_chat"You have chosen red colour.")
        }
        case 
2:
        {
            
fm_set_rendering(idkRenderFxGlowShell02250kRenderNormal16)
            
client_print(idprint_chat"You Have Chosen Green Colour.")
        }
        case 
3:
        {
            
fm_set_rendering(idkRenderFxGlowShell00225kRenderNormal16)
            
client_print(idprint_chat"You Have Chosen Blue Colour.")
        }
        case 
4:
        {
            
fm_set_rendering(idkRenderFxGlowShell2252250kRenderNormal16)
            
client_print(idprint_chat"You Have Chosen Yellow Colour.")
        }
        case 
5:
        {
            
fm_set_rendering(idkRenderFxGlowShell0225225kRenderNormal16)
            
client_print(idprint_chat"You Have Chosen Light Blue Colour.")
        } 


minimiller 06-23-2009 06:53

Re: Random Colour
 
if you chose to glow red from a menu, why would u need a repeatiung task to make them glow other colors?

Xellath 06-23-2009 06:55

Re: Random Colour
 
Quote:

Originally Posted by minimiller (Post 854858)
if you chose to glow red from a menu, why would u need a repeatiung task to make them glow other colors?

I thought about that to, wouldn't that just make this stupid?
Select a color from a menu, then it changes every second, what a waste. :P

hleV 06-23-2009 09:19

Re: Random Colour
 
PHP Code:

fm_set_rendering(idkRenderFxGlowShellrandom(255), random(255), random(255), kRenderNormal16); 



All times are GMT -4. The time now is 15:35.

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