AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin that runs "say thetime" when started recording a demo from console (https://forums.alliedmods.net/showthread.php?t=99284)

XerX 08-03-2009 12:31

Plugin that runs "say thetime" when started recording a demo from console
 
I tried to make a plugin which displays the current time(using "say thetime") when I type "record" in the console. I already tried in 2 different ways but it doesn't work. Here's what I tried and please correct where necessary or propose a new solution. Thank you in advance.

Code 1:
Quote:

#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME "record and thetime"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "darkspeed"

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_concmd("record", "record_time", ADMIN_ALL, "record thetime")
}

public
record_time(id)
{
client_cmd(id, "say thetime");
}

Code 2:
Quote:

#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME "record and thetime"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "darkspeed"

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_clcmd("record", "record_time", ADMIN_ALL, "record thetime")
}

public
record_time(id)
{
client_cmd(id, "say thetime");
}


Jack86 08-03-2009 15:12

Re: Plugin that runs "say thetime" when started recording a demo from console
 
Try something like this

PHP Code:

#include <amxmodx>
#include <amxmisc>


#define PLUGIN_NAME "record and thetime"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "darkspeed"

public plugin_init()
{
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
register_concmd("amx_record""record_time"ADMIN_ALL"record thetime")
register_concmd("amx_stoprecord""stop_record"ADMIN_ALL"stops rec+thetime")
}

public 
record_time(id)
{
client_cmd(id"record");
client_cmd(id"wait;wait;say thetime");
}

public 
stop_record(id)
{
client_cmd(id"stop");



XerX 08-03-2009 16:37

Re: Plugin that runs "say thetime" when started recording a demo from console
 
It didn't work right. I think I realized where the problem is but cannot fix it myself. Here's my thought: amx_record runs the command record, however it is nameless and therefore it doesn't create a .dem file, runs say thetime only. Somehow amx_record "name" must be converted to record "name"

Jack86 08-03-2009 17:09

Re: Plugin that runs "say thetime" when started recording a demo from console
 
Try like this:

PHP Code:

public record_time(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;

    new 
target[32], name[32];
    
read_argv(1target31);    
    new 
idtarget cmd_target(idtarget8);
    
get_user_name(idtargetname,31)
    
client_cmd(id"record %s"name);
    
client_cmd(id"wait;wait;say thetime");



Xellath 08-03-2009 17:23

Re: Plugin that runs "say thetime" when started recording a demo from console
 
Do you want to record another player, or yourself?

XerX 08-04-2009 07:00

Re: Plugin that runs "say thetime" when started recording a demo from console
 
Eventually, @hateYou from the official Bulgarian amxx site (amxmodxbg.org) helped out and it worked. Here's his suggestion:
Quote:

#include <amxmodx>

public plugin_init()
{
register_plugin("Hook recording", "1.0", "hateYou")
register_clcmd("fullupdate", "record")
}

public
record(id)
{
client_cmd(id, "say thetime")
return
PLUGIN_CONTINUE

}

I thank you all.


All times are GMT -4. The time now is 18:28.

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