Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alfino
Junior Member
Join Date: Mar 2005
Old 04-02-2005 , 19:30   Need some help. [ Not sure where i went wrong. ]
Reply With Quote #1

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.
alfino is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-02-2005 , 21:25   Re: Need some help. [ Not sure where i went wrong. ]
Reply With Quote #2

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)
xeroblood is offline
Send a message via MSN to xeroblood
alfino
Junior Member
Join Date: Mar 2005
Old 04-03-2005 , 03:28  
Reply With Quote #3

ahh... what was i thinking?

thanks! I'll update you guys.
alfino is offline
alfino
Junior Member
Join Date: Mar 2005
Old 04-03-2005 , 06:10  
Reply With Quote #4

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.
alfino 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 09:49.


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