Raised This Month: $51 Target: $400
 12% 

About register_event.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kevin14144
Member
Join Date: Jul 2007
Old 03-07-2012 , 07:34   About register_event.
Reply With Quote #1

Syntax:

register_event ( const event[], const function[], const flags[], [ cond=[], ... ] )


Q1:Where can i find conditions ?

Like:

2&#Game_C
2&#Game_w
2=#Game_will_restart_in

And what does it mean ?

Last edited by kevin14144; 03-07-2012 at 07:41.
kevin14144 is offline
kevin14144
Member
Join Date: Jul 2007
Old 03-07-2012 , 07:39   Re: About register_event.
Reply With Quote #2

Q2: What 's different ?
register_event("TextMsg", "Event_Restart", "a", "2&#Game_C", "2&#Game_w")
register_event("TextMsg", "restart", "a", "2=#Game_will_restart_in")

Last edited by kevin14144; 03-07-2012 at 07:41.
kevin14144 is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-07-2012 , 08:26   Re: About register_event.
Reply With Quote #3

http://wiki.amxmodx.org/Half-Life_1_Game_Events

The conditions are string from the second argument of TextMsg. You should be able to find them somewhere on the forums.

#2
The first one will be called on Game_Commencing & round restart, the second one only on round restart.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
kevin14144
Member
Join Date: Jul 2007
Old 03-07-2012 , 23:09   Re: About register_event.
Reply With Quote #4

Quote:
Originally Posted by drekes View Post
http://wiki.amxmodx.org/Half-Life_1_Game_Events

The conditions are string from the second argument of TextMsg. You should be able to find them somewhere on the forums.

#2
The first one will be called on Game_Commencing & round restart, the second one only on round restart.
But i want to reset some value when sv restart.

I use this code :
register_event("TextMsg", "Event_Restart", "a", "2&#Game_C", "2&#Game_w")

But it not work , so i change to the other one. It work.:
register_event("TextMsg", "restart", "a", "2=#Game_will_restart_in")

Why...?
kevin14144 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-08-2012 , 00:23   Re: About register_event.
Reply With Quote #5

Both codes seems ok, you may have badly named the event callback (public function name).

Anyway, it's better to wait for new round to reset values when you catch the reset message, restart can be set to 60 seconds for example, or you can get multiple message before the round is actually restarted.

PHP Code:
#include <amxmodx>

new bool:g_bIsRestarting

public plugin_init()
{
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bIsRestarting )
    {
        
g_bIsRestarting false
        
        
// Reset your values here
    
}
}

public 
Event_TextMsg_Restart()
{
    
g_bIsRestarting true

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
kevin14144
Member
Join Date: Jul 2007
Old 03-08-2012 , 06:52   Re: About register_event.
Reply With Quote #6

drekes ConnorMcLeod .Thanks u.
kevin14144 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:58.


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