Raised This Month: $ Target: $400
 0% 

[SOLVED]: Rename a file from cstrike_swedish


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OFFBEAT
Junior Member
Join Date: Feb 2011
Location: Sweden
Old 08-05-2011 , 20:46   [SOLVED]: Rename a file from cstrike_swedish
Reply With Quote #1

Im creating a small and easy autorenamer and I can't figure out how to find or rename files from the cstrike_swedish folder that some of the players are using.

Because rename_file starts in normal cstrike how do I find cstrike_swedish folder properly to rename a file?

I have this code:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Chip"
#define VERSION "1.0"
#define AUTHOR "OFFBEAT"

#define MAX_ARRAY    32     // Max number of letters in map and name
#define MAX_DEMO    128    // Max size of demo name


//Create a global array for the playername, mapname and new demo
new g_szJumper[MAX_ARRAY];
new 
g_szMapname[MAX_ARRAY];
new 
g_szDemName[MAX_ARRAY 1][MAX_DEMO];

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
register_clcmd"say /end""fnEnd" );  // When recorder types /end kill the player, stop the recording and rename the demo
}

public 
fnEndid )
{
    
client_cmdid"kill" );  // Kill player by console
    
    
set_task1.0"fnStopDemo"id );  // Set the task to stop demo
    
    
get_user_nameidg_szJumpersizeofg_szJumper ) );  // Get the playername
    
get_mapnameg_szMapnamesizeofg_szMapname ) );  // Get the mapname
    
    
formatg_szDemName[id], MAX_DEMO 1"%s_%s.dem"g_szMapnameg_szJumper ); // Save the new demo as mapname_playername
    
    
server_print"*** Demo saved as: %s ***"g_szDemName[id] ); // Print out the new demo name
    
    
return PLUGIN_HANDLED;
}

// Stop the current demo recording and start a renaming task
public fnStopDemoid )
{
    
client_cmdid"stop" );
    
    
set_task0.5"fnRenameDemo"id );
    
    return 
PLUGIN_HANDLED;
}

// Rename the current recorded demo to mapname_playername
public fnRenameDemoid )
{
    
rename_file"newdemo.dem"g_szDemName[id], ); // On this part I need to find file from the cstrike_swedish folder
    
    
return PLUGIN_HANDLED;



SOLVED:
PHP Code:
public fnRenameDemoid )
{
    
rename_file"newdemo.dem"g_szDemName[id], );
    
    return 
PLUGIN_HANDLED;

to
PHP Code:
// new g_szDemo [MAX_DEMO * 2];  - in global

public fnRenameDemoid )
{
    
formatexg_szDemosizeofg_szDemo ), "../cstrike_swedish/%s"g_szDemName[id] );
    
rename_file"../cstrike_swedish/newdemo.dem"g_szDemotrue );
    
    return 
PLUGIN_HANDLED;



Thanks Hunter-Digital!

Last edited by OFFBEAT; 08-07-2011 at 23:15. Reason: Solved it
OFFBEAT is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-05-2011 , 21:04   Re: Rename a file from cstrike_swedish
Reply With Quote #2

You can't modify client files.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
OFFBEAT
Junior Member
Join Date: Feb 2011
Location: Sweden
Old 08-05-2011 , 21:21   Re: Rename a file from cstrike_swedish
Reply With Quote #3

So it's impossible to rename a demo in cstrike_swedish when it's possible in cstrike? Why's that.
OFFBEAT is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-05-2011 , 22:11   Re: Rename a file from cstrike_swedish
Reply With Quote #4

It's not possible at all to modify client-side files.
You can only rename server files.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
OFFBEAT
Junior Member
Join Date: Feb 2011
Location: Sweden
Old 08-05-2011 , 22:13   Re: Rename a file from cstrike_swedish
Reply With Quote #5

Its lan recording demos for kz.
OFFBEAT is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-06-2011 , 02:16   Re: Rename a file from cstrike_swedish
Reply With Quote #6

Quote:
Originally Posted by OFFBEAT View Post
Its lan recording demos for kz.
Doesn't matter. A plugin on the server cannot do it.
__________________
fysiks is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-06-2011 , 09:21   Re: Rename a file from cstrike_swedish
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Doesn't matter. A plugin on the server cannot do it.
His plugin is for listenservers..
__________________
xPaw is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-06-2011 , 09:37   Re: Rename a file from cstrike_swedish
Reply With Quote #8

Try 0 as the 3rd param on rename_file() and add the path before it... like so: "cstrike_swedish/demo.dem"
__________________
Hunter-Digital is offline
OFFBEAT
Junior Member
Join Date: Feb 2011
Location: Sweden
Old 08-06-2011 , 19:32   Re: Rename a file from cstrike_swedish
Reply With Quote #9

Quote:
Originally Posted by Hunter-Digital View Post
Try 0 as the 3rd param on rename_file() and add the path before it... like so: "cstrike_swedish/demo.dem"
Didn't work
OFFBEAT is offline
OFFBEAT
Junior Member
Join Date: Feb 2011
Location: Sweden
Old 08-06-2011 , 08:35   Re: Rename a file from cstrike_swedish
Reply With Quote #10

I think you guys get me wrong here, it is for recording on my own lan and im alone on the server and recording demos for myself (and it works perfectly on cstrike). My only question then is, is it impossible to retrieve a path to cstrike_swedish?

Last edited by OFFBEAT; 08-06-2011 at 08:42.
OFFBEAT 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 03:21.


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