This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Better Way (Less CPU, WIN MSG)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 07-30-2011 , 09:41   Better Way (Less CPU, WIN MSG)
Reply With Quote #1

Code:
#include <amxmodx> 

new g_TextPoruka

public plugin_init() 
{ 
	register_plugin("Poruka", "1.0", "OvidiuS") 
	register_event("SendAudio", "Pobeda", "a", "2&%!MRAD_terwin");
	register_event("SendAudio", "Pobeda", "a", "2&%!MRAD_ctwin");
} 

public Pobeda()
	g_TextPoruka = register_message( get_user_msgid("TextMsg"), "Pobedili_Ovi_ili_Oni" )

public Pobedili_Ovi_ili_Oni(PorukaID) 
{ 
	new mojaPoruka[32] 
	get_msg_arg_string(2, mojaPoruka, charsmax(mojaPoruka)) 

	if(equal(mojaPoruka, "#CTs_Win"))
		set_msg_arg_string(2, "Avatari pobedili")
	else if(equal(mojaPoruka, "#Terrorists_Win"))
		set_msg_arg_string(2, "Oni drugi pobedili")

	unregister_message(PorukaID, g_TextPoruka)

	return PLUGIN_CONTINUE;
}
or
Code:
#include <amxmodx> 
#include <amxmisc> 

#define PLUGIN "Team Winner" 
#define VERSION "1.0" 
#define AUTHOR "Sn!ff3r" 

public plugin_init() { 
    register_plugin(PLUGIN, VERSION, AUTHOR) 
    register_message(get_user_msgid("TextMsg") ,"message_TextMsg") 
} 

public message_TextMsg( const MsgId, const MsgDest, const MsgEntity ) 
{     
    static message[32] 
    get_msg_arg_string(2, message, charsmax(message)) 
     
    if(equal(message, "#Terrorists_Win")) 
    { 
        set_msg_arg_string(2, "Team #1 win!") 
    } 
    else if(equal(message, "#CTs_Win")) 
    { 
        set_msg_arg_string(2, "Team #2 win!") 
    } 
}
i know there's no big difference in CPU usage, but something must be better than other, so which one is better?
OvidiuS is offline
Send a message via Skype™ to OvidiuS
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-30-2011 , 10:30   Re: Better Way (Less CPU, WIN MSG)
Reply With Quote #2

2nd one.
__________________
hleV 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 14:56.


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