Raised This Month: $ Target: $400
 0% 

[SOLVED]: Rename a file from cstrike_swedish


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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