AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cant seem to get register_logevent working (https://forums.alliedmods.net/showthread.php?t=5450)

EKS 09-02-2004 04:10

Cant seem to get register_logevent working
 
Code:
public plugin_init() {     register_plugin("CVAR  change","1.0.0","EKS")       register_logevent("cvar_changed",0,"mp_timelimit") } public cvar_changed() {     new Arg[14]     read_logargv(0,Arg,13)     server_cmd("echo cvar_changed function called")     if(equal(Arg,"mp_timelimit"))     {         server_cmd("echo mp_timelimit changed")         remove_task(1+32)         new Float:TaskTime = float(get_timeleft()) - 10.0         set_task(TaskTime,"task_ShowStats",1+32);     } }

From the include it looks like it should work:
Quote:

/* Registers log event on which the given function will be called
* Examples for conditions:
* "0=World triggered" "1=Game_Commencing"
* "1=say"
* "3=Terrorists_Win"
* "1=entered the game"
* "0=Server cvar"
*/
native register_logevent(const function[], argsnum, ... );
Well, i cant seem to get it working. If someone can point out the error to be id be greatfull

Freecode 09-02-2004 04:39

Code:
register_logevent("cvar_changed",0)

EKS 09-02-2004 05:05

I have tried that to. Cant seem to make that work either[/code]

Ingram 09-02-2004 14:23

take a look at runemod there is a logevent there

PM 09-02-2004 15:18

Try:
Code:
register_logevent("cvar_changed",4,"1=Server cvar", "2=mp_timelimit")

EKS 09-02-2004 17:21

Quote:

Originally Posted by JJkiller
take a look at runemod there is a logevent there

It uses it to catch the round start.

Quote:

Originally Posted by PM
Try:
Code:
register_logevent("cvar_changed",4,"1=Server cvar", "2=mp_timelimit")

Does not seem to work either. I just dunno

PM 09-03-2004 07:00

Hehe ok, I assume you want to catch the event
Server cvar "mp_timelimit" = "xx"
Anyway, register_logevent works like this (if I remember correctly):
register_logevent("Func to be called", number of total arguments of the event, argument specifications).
AFAIK, every " char indicates a new argument. That would mean that argument 0 is "Server cvar" and argument 1 is "mp_timelimit".
You might want to try this:
Code:
register_logevent("cvar_changed",4,"0=Server cvar", "1=mp_timelimit")
I will test it as soon as I will have access to a running Half Life install.

EKS 09-04-2004 10:44

hmm, that dident work either. I just dont understand why.


All times are GMT -4. The time now is 17:13.

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