AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   client_print add player nick & ip (https://forums.alliedmods.net/showthread.php?t=105709)

-ynk 10-07-2009 10:56

client_print add player nick & ip
 
Hi there ;)
I have auto pov demo plugin, but this plugin are not showing player nickname and ip adress...

Code:

/****************************************/
/*                    */
/*    Auto Demo Recorder        */
/*    by IzI                */
/*                    */
/****************************************/

#include <amxmodx>
#pragma semicolon 1

new g_Toggle, g_DMod, g_UseNI, g_RStartAfter, g_DemoName, g_DemoNamePrefix;

public plugin_init() {
    register_plugin( "Auto Demo Recorder", "1.5", "IzI" );
    g_Toggle        = register_cvar( "amx_demo",        "1" );
    g_DMod            = register_cvar( "amx_demo_mode",    "0" );
    g_UseNI        = register_cvar( "amx_demo_steamid",    "0" );
    g_RStartAfter        = register_cvar( "amx_demo_rectime",    "15" );    // If it is less than 5, it will automatically set to 5, but willn't apply the changes to the console. I recoment to use default settings.
    g_DemoName        = register_cvar( "amx_demo_name",    "CHILL-Public" );
    g_DemoNamePrefix    = register_cvar( "amx_demo_prefix",    "POV DEMO" );
    register_dictionary( "demorecorder.txt" );
}

public client_putinserver( id ) {
    if( get_pcvar_num( g_Toggle ) ) {
        new Float:delay = get_pcvar_float( g_RStartAfter );
        if( delay < 5 )
            set_pcvar_float( g_RStartAfter, ( delay = 5.0 ) );
        set_task( delay, "Record", id );
    }
}

public Record( id ) {
    if( !is_user_connected( id ) || get_pcvar_num( g_Toggle ) != 1 )
        return;

    // Getting time, client SteamID, server's name, server's ip with port.
    new szSName[128], szINamePrefix[64], szTimedata[9];
    new iUseIN = get_pcvar_num( g_UseNI );
    new iDMod = get_pcvar_num( g_DMod );
    get_pcvar_string( g_DemoNamePrefix, szINamePrefix, 63 );
    get_time ( "%H:%M:%S", szTimedata, 8 );

    switch( iDMod ) {
        case 0: get_pcvar_string( g_DemoName, szSName, 127 );
        case 1: get_user_ip( 0, szSName, 127, 0 );
        case 2: get_user_name( 0, szSName, 127 );
    }

    if( iUseIN ) {
        new szCID[32];
        get_user_authid( id, szCID, 31 );
        format( szSName, 127, "[%s]%s", szCID, szSName );
    }

    // Replacing signs.
    replace_all( szSName, 127, ":", "_" );
    replace_all( szSName, 127, ".", "_" );
    replace_all( szSName, 127, "*", "_" );
    replace_all( szSName, 127, "/", "_" );
    replace_all( szSName, 127, "|", "_" );
    replace_all( szSName, 127, "\", "_" );
    replace_all( szSName, 127, "?", "_" );
    replace_all( szSName, 127, ">", "_" );
    replace_all( szSName, 127, "<", "_" );
    replace_all( szSName, 127, " ", "_" );

    // Displaying messages.
    client_cmd( id, "stop; record ^"%s^"", szSName );
    client_print( id, print_chat, "[POV DEMO] Recording has started... ");
    client_print( id, print_chat, "[%s] %L ^"%s.dem^"", szINamePrefix, LANG_PLAYER, "RECORDINGIN", szSName );
    client_print( id, print_chat, "[%s] %L", szINamePrefix, LANG_PLAYER, "RECORDINGAT", szTimedata );
    client_print( id, print_chat, "Here i need player nick and ip");
}

client_print( id, print_chat, "Here i need player nick and ip");

Can somebody help with a little bit edit ?

biscuit628 10-07-2009 11:16

Re: client_print add player nick & ip
 
PHP Code:

/****************************************/
/*                    */
/*    Auto Demo Recorder        */
/*    by IzI                */
/*                    */
/****************************************/

#include <amxmodx>
#pragma semicolon 1

new g_Toggleg_DModg_UseNIg_RStartAfterg_DemoNameg_DemoNamePrefix;

public 
plugin_init() { 
    
register_plugin"Auto Demo Recorder""1.5""IzI" );
    
g_Toggle         register_cvar"amx_demo",        "1" );
    
g_DMod            register_cvar"amx_demo_mode",    "0" );
    
g_UseNI         register_cvar"amx_demo_steamid",    "0" );
    
g_RStartAfter         register_cvar"amx_demo_rectime",    "15" );    // If it is less than 5, it will automatically set to 5, but willn't apply the changes to the console. I recoment to use default settings.
    
g_DemoName         register_cvar"amx_demo_name",    "CHILL-Public" );
    
g_DemoNamePrefix    register_cvar"amx_demo_prefix",    "POV DEMO" );
    
register_dictionary"demorecorder.txt" );
}

public 
client_putinserverid ) {
    if( 
get_pcvar_numg_Toggle ) ) {
        new 
Float:delay get_pcvar_floatg_RStartAfter );
        if( 
delay )
            
set_pcvar_floatg_RStartAfter, ( delay 5.0 ) );
        
set_taskdelay"Record"id );
    }
}

public 
Recordid ) {
    if( !
is_user_connectedid ) || get_pcvar_numg_Toggle ) != )
        return;

    
// Getting time, client SteamID, server's name, server's ip with port.
    
new szSName[128], szINamePrefix[64], szTimedata[9];
    new 
iUseIN get_pcvar_numg_UseNI );
    new 
iDMod get_pcvar_numg_DMod );
    
get_pcvar_stringg_DemoNamePrefixszINamePrefix63 );
    
get_time "%H:%M:%S"szTimedata);

    switch( 
iDMod ) {
        case 
0get_pcvar_stringg_DemoNameszSName127 );
        case 
1get_user_ip0szSName127);
        case 
2get_user_name0szSName127 );
    }

    if( 
iUseIN ) {
        new 
szCID[32];
        
get_user_authididszCID31 );
        
formatszSName127"[%s]%s"szCIDszSName );
    }

    
// Replacing signs.
    
replace_allszSName127":""_" );
    
replace_allszSName127".""_" );
    
replace_allszSName127"*""_" );
    
replace_allszSName127"/""_" );
    
replace_allszSName127"|""_" );
    
replace_allszSName127"\", "_" );
    replace_all( szSName, 127, "
?", "_" );
    replace_all( szSName, 127, "
>", "_" );
    replace_all( szSName, 127, "
<", "_" );
    replace_all( szSName, 127, " ", "
_" );

    // Displaying messages.
    client_cmd( id, "
stoprecord ^"%s^"", szSName );
    client_print( id, print_chat, "
[POV DEMORecording has started... ");
    client_print( id, print_chat, "
[%s] %^"%s.dem^"", szINamePrefix, LANG_PLAYER, "RECORDINGIN", szSName );
    client_print( id, print_chat, "
[%s] %L", szINamePrefix, LANG_PLAYER, "RECORDINGAT", szTimedata );

    new name[33],ip[17]
    get_user_name(id,name,32)
    get_user_ip(id,ip,16,1)
    client_print( id, print_chat, "
Playernick:%s,IP:%s",name,ip);



-ynk 10-08-2009 08:21

Re: client_print add player nick & ip
 
Thanks man :)

Can you add some lines for server hostname olso ?


I think this line:
PHP Code:

client_printidprint_center"Recording has started..."); 

will be usefull if there will be printing out server hostname.

biscuit628 10-08-2009 12:20

Re: client_print add player nick & ip
 
PHP Code:

    // Displaying messages.
    
client_cmdid"stop; record ^"%s^""szSName );

    new 
szHostname[128]
    
get_cvar_string("hostname",szHostname,127)
    
client_printidprint_chat"[POV DEMO] Hostname:%s",szHostname);
    
client_printidprint_chat"[%s] %L ^"%s.dem^""szINamePrefixLANG_PLAYER"RECORDINGIN"szSName );
    
client_printidprint_chat"[%s] %L"szINamePrefixLANG_PLAYER"RECORDINGAT"szTimedata );

    new 
name[33],ip[17]
    
get_user_name(id,name,32)
    
get_user_ip(id,ip,16,1)
    
client_printidprint_chat"Playernick:%s,IP:%s",name,ip); 



All times are GMT -4. The time now is 22:42.

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