Raised This Month: $ Target: $400
 0% 

demo recorder


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
outsiderlv
Senior Member
Join Date: Mar 2010
Old 08-20-2010 , 02:23   demo recorder
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "auto demo recorder"
#define VERSION "2.0 updated"
#define AUTHOR "outsider"

public plugin_init() {
    
register_plugin(PLUGIN,VERSION,AUTHOR)
}

public 
client_putinserver(id) {
    
set_task(5.0,"record_demo",id)
    return 
PLUGIN_CONTINUE
}

public 
record_demo(id) {
    new 
servername[65];
    new 
demoname[16];
    
    
get_user_name(0,servername,64);
    if(
servername == "JB.RETRY.LV JAILBREAK 47/48p") {
        
demoname "jb_retry_lv";
        } else if(
servername == "HNS.RETRY.LV HIDE AND SEEK 47/48p") {
        
demoname "hns_retry_lv";
        } else if(
servername == "BB.RETRY.LV BASE BUILDER 47/48p") {
        
demoname "bb_retry_lv";
        } else if(
servername == "DD2.RETRY.LV DUST 2 LAND 47/48p") {
        
demoname "dd2_retry_lv";
        } else if(
servername == "CS.RETRY.LV PUBLIC 47/48p") {
        
demoname "cs_retry_lv";
        } else if(
servername == "ZM.RETRY.LV ZM+WAR3 47/48p") {
        
demoname "zm_retry_lv";
        } else if(
servername == "DR.RETRY.LV DEATHRUN 47/48p") {
        
demoname "dr_retry_lv";
        } else if(
servername == "SURF.RETRY.LV SURF 47/48p") {
        
demoname "surf_retry_lv";
        } else {
        
demoname "retry_lv";
    }
    
    new 
name[35];
    
get_user_name(id,name,34); 
    
    new 
userip[20]
    
get_user_ip(id,userip,19);
    
    new 
serverip[20]
    
get_user_ip(0,serverip,19);
    
    
client_cmd(id,"stop;record %s",demoname)
    
client_print(id,print_center,"Recording to %s started...",demoname)
    
client_print(id,print_chat,"Serveris: %s (%s)",servername,serverip)
    
client_print(id,print_chat,"Niks: %s | IP: %s",name,userip)
    return 
PLUGIN_CONTINUE

When i compile:
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Error
: Array must be indexed (variable "servername"on line 22
Error
: Array must be indexed (variable "servername"on line 24
Error
: Array must be indexed (variable "servername"on line 26
Error
: Array must be indexed (variable "servername"on line 28
Error
: Array must be indexed (variable "servername"on line 30
Error
: Array must be indexed (variable "servername"on line 32
Error
: Array must be indexed (variable "servername"on line 34
Error
: Array must be indexed (variable "servername"on line 36

8 Errors
.
Could not locate output file C:\Documents and Settings\Boss\Desktop\Plugins\scripting\retryrecorddemo.amx (compile failed). 
outsiderlv is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-20-2010 , 02:34   Re: demo recorder
Reply With Quote #2

When comparing arrays you must use either contain, containi, equal, or equali. The i at the end makes it case-insensitive, so if you want exact name with case sensitive, don't put the i, otherwise if it doesn't matter, leave the i.

So:

Code:
if(servername == "JB.RETRY.LV JAILBREAK 47/48p")


->

Code:
if(equali(servername,"JB.RETRY.LV JAILBREAK 47/48p"))


And change all of them btw.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
outsiderlv
Senior Member
Join Date: Mar 2010
Old 08-20-2010 , 02:34   Re: demo recorder
Reply With Quote #3

Thanks. BTW, is there any way to check if smthn contains some text (ex. HNS.RETRY.LV) so i dont have to check full name?
outsiderlv is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-20-2010 , 02:48   Re: demo recorder
Reply With Quote #4

That's what contain is for.
Code:
if(containi(servername, "HNS.RETRY.LV")
{
//do something
}
Also, i just looked at ur full code, and I'm just wondering, if you're calling the task every 5 seconds when they are put in the server, and their name is w/e (HNS.RETRY.LV) or w/e, it will keep stopping and starting the demo over and over and over again won't it?

Last edited by nikhilgupta345; 08-20-2010 at 02:50.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
outsiderlv
Senior Member
Join Date: Mar 2010
Old 08-20-2010 , 03:31   Re: demo recorder
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "auto demo recorder"
#define VERSION "2.0 updated"
#define AUTHOR "outsider"

new servername[65];
new 
demoname[16];
new 
bool:user_demo_recorder[35] = false;

public 
plugin_init() {
    
register_plugin(PLUGIN,VERSION,AUTHOR)
    
set_task(4.0,"server");
}

public 
client_putinserver(id) {
    
set_task(5.0,"record_demo",id)
    return 
PLUGIN_CONTINUE
}

public 
server() {
    
get_user_name(0,servername,64);
    if(
equali(servername,"JB.RETRY.LV JAILBREAK 47/48p")) {
        
demoname "jb_retry_lv";
        } else if(
equali(servername,"HNS.RETRY.LV HIDE AND SEEK 47/48p")) {
        
demoname "hns_retry_lv";
        } else if(
equali(servername,"BB.RETRY.LV BASE BUILDER 47/48p")) {
        
demoname "bb_retry_lv";
        } else if(
equali(servername,"DD2.RETRY.LV DUST 2 LAND 47/48p")) {
        
demoname "dd2_retry_lv";
        } else if(
equali(servername,"CS.RETRY.LV PUBLIC 47/48p")) {
        
demoname "cs_retry_lv";
        } else if(
equali(servername,"ZM.RETRY.LV ZM+WAR3 47/48p")) {
        
demoname "zm_retry_lv";
        } else if(
equali(servername,"DR.RETRY.LV DEATHRUN 47/48p")) {
        
demoname "dr_retry_lv";
        } else if(
equali(servername,"SURF.RETRY.LV SURF 47/48p")) {
        
demoname "surf_retry_lv";
        } else {
        
demoname "retry_lv";
    }
}

public 
record_demo(id) {
    if(
user_demo_recorder[id]) {
        return 
PLUGIN_HANDLED;
    }
    new 
name[35];
    
get_user_name(id,name,34); 
    
    new 
userip[20]
    
get_user_ip(id,userip,19);
    
    new 
serverip[20]
    
get_user_ip(0,serverip,19);
    
    
client_cmd(id,"stop;record %s",demoname)
    
client_print(id,print_center,"Recording to %s started...",demoname)
    
client_print(id,print_chat,"Serveris: %s (%s)",servername,serverip)
    
client_print(id,print_chat,"Niks: %s | IP: %s",name,userip)
    
user_demo_recorder[id] = true;
    return 
PLUGIN_CONTINUE

Is this better? And how can i avoid the shitty checking?

Last edited by outsiderlv; 08-20-2010 at 03:35.
outsiderlv is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-20-2010 , 04:03   Re: demo recorder
Reply With Quote #6

Hmm, can u record from the actual server? get_user_name 0 i think get's the hostname right? So I don't think that the server can record unless u have HLTV.

Unless u have a player in the server just sitting there like a bot but an actual player who is recording?

So this is what I would do, I'd make it only check once, when the client enters the server, so you don't have a task.

Basically what this does if a person enters and their name is HNS......TV or w/e, it will send the command "record %s", demoname to them obviously not that exact command but w/e. So the person that is recording must be you or someone that you have access to their steam files and stuff. Then it will save the demo to their cstrike folder. Only downfall is that if they get kicked or soemthing, it won't stop recording.

So this is what I got.

Untested:
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "auto demo recorder"
#define VERSION "2.0 updated"
#define AUTHOR "outsider"

new servername[65];
new demoname[16];

public plugin_init() {
    register_plugin(PLUGIN,VERSION,AUTHOR)
}

public client_putinserver(id) {
    server(id)
    return PLUGIN_CONTINUE
}

public server(id) {
    get_user_name(id,servername,64);
    if(equali(servername,"JB.RETRY.LV JAILBREAK 47/48p")) {
        demoname = "jb_retry_lv";
        record_demo(id)
        } else if(equali(servername,"HNS.RETRY.LV HIDE AND SEEK 47/48p")) {
    demoname = "hns_retry_lv";
    record_demo(id)
        } else if(equali(servername,"BB.RETRY.LV BASE BUILDER 47/48p")) {
    demoname = "bb_retry_lv";
    record_demo(id)
        } else if(equali(servername,"DD2.RETRY.LV DUST 2 LAND 47/48p")) {
    demoname = "dd2_retry_lv";
    record_demo(id)
        } else if(equali(servername,"CS.RETRY.LV PUBLIC 47/48p")) {
    demoname = "cs_retry_lv";
    record_demo(id)
        } else if(equali(servername,"ZM.RETRY.LV ZM+WAR3 47/48p")) {
    demoname = "zm_retry_lv";
    record_demo(id)
        } else if(equali(servername,"DR.RETRY.LV DEATHRUN 47/48p")) {
    demoname = "dr_retry_lv";
    record_demo(id)
        } else if(equali(servername,"SURF.RETRY.LV SURF 47/48p")) {
    demoname = "surf_retry_lv";
    record_demo(id)
        } else {
    demoname = "retry_lv";
    record_demo(id)
    }
}

public record_demo(id) {
    new name[35];
    get_user_name(id,name,34);
    
    new userip[20]
    get_user_ip(id,userip,19);
    
    new serverip[20]
    get_user_ip(0,serverip,19);
    
    client_cmd(id,"stop;record %s",demoname)
    client_print(id,print_center,"Recording to %s started...",demoname)
    client_print(id,print_chat,"Serveris: %s (%s)",servername,serverip)
    client_print(id,print_chat,"Niks: %s | IP: %s",name,userip)
    return PLUGIN_CONTINUE
}

Last edited by nikhilgupta345; 08-20-2010 at 04:06.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
outsiderlv
Senior Member
Join Date: Mar 2010
Old 08-20-2010 , 04:15   Re: demo recorder
Reply With Quote #7

Check my code again. Everything is finu but i need to call the record only 1 time for each player.
outsiderlv is offline
Rosenstein
Senior Member
Join Date: Feb 2008
Location: Serbia
Old 08-20-2010 , 07:15   Re: demo recorder
Reply With Quote #8

Why don't you use Auto Demo Recorder
Also, 47/48p is not supported.
__________________
+1
Rosenstein is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-20-2010 , 07:25   Re: demo recorder
Reply With Quote #9

I must say that get_user_name(0) doesnt get the hostname.
SpeeDeeR is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-20-2010 , 07:44   Re: demo recorder
Reply With Quote #10

Quote:
Originally Posted by SpeeDeeR View Post
I must say that get_user_name(0) doesnt get the hostname.
I must say that you're wrong.

Anyway, his server is non-steam.
__________________
xPaw 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 21:53.


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