AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Logs for amx_ss (https://forums.alliedmods.net/showthread.php?t=338053)

Desure 06-02-2022 19:23

Logs for amx_ss
 
Hello guys,

I need some help with a ultimate ss maker.

I want to add logs file for it, like a txt file with admin name, player name, time etc when command is executed.

Can someone guide me?

lexzor 06-02-2022 20:55

Re: Logs for amx_ss
 
First of all, do you have a open source ss plugin? In this way someone could just add the log file.

Desure 06-03-2022 01:58

Re: Logs for amx_ss
 
Sure, let me arrive home, after 16:00, i will post it here, thanks

Desure 06-03-2022 08:54

Re: Logs for amx_ss
 
https://pastebin.com/RAi9MunU

lexzor 06-03-2022 11:50

Re: Logs for amx_ss
 
try this one

PHP Code:

#include <amxmodx>
 
#include <amxmisc>
 
#define FILE_NAME "screenshot_logs.ini"
 
new gmsgFade
 
public plugin_init()

    
register_plugin("Ultimate SS Taker""V 2.1""navir")
    
register_concmd("amx_ss""ScreenShot"ADMIN_KICK"amx_ss <player>")
    
gmsgFade get_user_msgid("ScreenFade"
}
  
new 
name_player[32],param,pozes,poze

public ScreenShot(idlevelcid)
 
{
 
    if (!
cmd_access(idlevelcid2))
 
    return 
PLUGIN_HANDLED        
 
 
 
    
new arg[32], ip_player[32]
 
    
read_argv(1arg31)
 
 
 
    new 
player cmd_target(idarg4)
 
 
 
    if (!
player)
 
    return 
PLUGIN_HANDLED
 
 
 
    get_user_name
(playername_player31);
 
    
get_user_ip(playerip_player311);
 
 
 
    
client_print(idprint_chat"Nick: ^"%s^" - Ip: %s"name_player,ip_player);
 
 
 
    
client_print(idprint_console"Nick: ^"%s^" - Ip: %s"name_player,ip_player);
 
    
client_print(idprint_console"Nick: ^"%s^" - Ip: %s"name_player,ip_player);
 
    
client_print(idprint_console"Nick: ^"%s^" - Ip: %s"name_player,ip_player);
 
 
 
    
pozes=5
 
    poze
=1
 
 
 
    client_print
(idprint_chat"^"%s^" must give you 5 photos, one of them must be GREEN !"name_player);
 
 
 
    new 
hostname[64], name_admin[32], timer[32];
 
 
 
      
get_cvar_string("hostname",hostname,63);
 
    
get_user_name(idname_admin31);
 
       
get_time("%m/%d/%Y - %H:%M:%S"timer,31);
 
 
 
    
client_print(playerprint_center"PHOTO # %d CS"poze+1);
 
 
 
    
client_print(playerprint_chat"--------------------------------------------");
 
    
client_print(playerprint_chat"Admin: ^"%s^" made you a screenshot !"name_admin);
 
    
client_print(playerprint_chat"Your nick: ^"%s^" - Your Ip: %s"name_playerip_player);
 
    
client_print(playerprint_chat"Date and time: %s - Server: ^"%s^""timerhostname);
 
    
client_print(playerprint_chat"--------------------------------------------");
 
 
 
    
client_cmd(player,"snapshot");
 
    
write_logfile(name_adminname_playerip_playertimercharsmax(timer));
 
    
poze++
 
    
param=player
 
    set_task
(1.0,"GreenShot",3322,_,_,"b");
 
    return 
PLUGIN_HANDLED
 
}
 
write_logfile(name_admin[], name_player[], ip_player[], timer[], bufflength)
{
    new 
szFile[164], szConfigsDir[128];
    
get_configsdir(szConfigsDircharsmax(szConfigsDir));

    
formatex(szFilecharsmax(szFile), "%s/%s"szConfigsDirFILE_NAME);

    if(
file_exists(szFile))
    {
        new 
iFile fopen(szFile"w");
        new 
szMessage[192];
        
replace(timerbufflength"-""at");
        
formatex(szMessagecharsmax(szMessage), "[%s] Admin %s did ss on %s (%s)"timername_adminname_playerip_player);
        
fputs(iFileszMessage);
        
fclose(iFile);
    } else 
log_amx("Error! File ^"%s^" does not exists"szFile);

}
 
 
public 
GreenShot(idlevelcid)
 
{
 
    if(
poze pozes) {
 
 
    if(
poze==3) {
 
 
 
            
message_begin(MSG_ONEgmsgFade, {0,0,0},param)
 
                 
write_short(14<<7)
 
                 
write_short(58<<6)
 
                 
write_short(1<<0)
 
                 
write_byte(5)
 
                 
write_byte(255)
 
                
write_byte(0)
 
                
write_byte(255)
 
            
message_end()
 
    }
 
 
 
    new 
hostname[64], name_player[32], ip_player[32], timer[32];
 
    new 
frags get_user_frags (param)
 
    new 
deaths get_user_deaths (param)
 
 
 
    
get_cvar_string("hostname",hostname,63);
 
    
get_user_name(param,name_player,31);
 
    
get_user_ip(paramip_player311);
 
    
get_time("%m/%d/%Y - %H:%M:%S"timer,31);
 
 
 
    
client_print(paramprint_center"PHOTO # %d"poze+1);
 
 
 
    
client_print(paramprint_chat"--------------------------------------------");
 
    
client_print(paramprint_chat"Your frags: %d - Your deaths: %d",fragsdeaths);
 
    
client_print(paramprint_chat"Your nick: ^"%s^" - Your Ip: %s"name_playerip_player);
 
    
client_print(paramprint_chat"Date and time: %s - Server: ^"%s^""timerhostname);
 
    
client_print(paramprint_chat"--------------------------------------------");
 
 
 
    
client_cmd(param,"snapshot");
 
    
poze++
 
 
 
    } else {
 
 
 
        
client_cmd(param,"snapshot");
 
        
client_cmd(param,"kill;wait;jointeam 6");
 
 
 
        
get_user_name(paramname_player31);
 
 
 
        
client_print(0print_chat"SS was taken from ^"%s^" !"name_player);
 
 
 
        
client_print(paramprint_chat"%s, 5 photos were taken."name_player);
 
        
client_print(paramprint_chat"Use say_team @ and it will be seen only by admins!");
 
 
 
        
remove_task(3322);
 
 
 
    }
 
 
 
    return 
PLUGIN_HANDLED;
 


you must create screenshot_logs.ini in your config file

Desure 06-06-2022 08:04

Re: Logs for amx_ss
 
I added screenshot_logs.ini in config.cfg and i creat a .ini file in amxmodx/configs, doesn't save info in file. Maybe i didn't do something right, sorry, but i don't know much about plugins etc

Desure 06-06-2022 08:43

Re: Logs for amx_ss
 
i have this plugin already amxx, maybe i have to delete it and compile that sma? i only edit sma file, i let old amxx file there

OciXCrom 06-06-2022 14:02

Re: Logs for amx_ss
 
That means you didn't do anything. The plugin is the .amxx file, not the .sma. You need to compile it of course.

fysiks 06-06-2022 23:58

Re: Logs for amx_ss
 
Quote:

Originally Posted by Desure (Post 2781103)
I added screenshot_logs.ini in config.cfg and i creat a .ini file in amxmodx/configs, doesn't save info in file. Maybe i didn't do something right, sorry, but i don't know much about plugins etc

He meant to say create the file in the config folder, there is nothing to do win config.cfg (I don't recall there ever being a config.cfg file unless it's from some plugin that isn't this plugin).

Regarding using the new code, the code that is actually being executed is the compiled code which is in binary .amxx file. So, you need to compile the source code (.sma) and then replace your .amxx file and then restart your server. The .sma file is not required on the server for the plugin to run.

lexzor 06-07-2022 07:56

Re: Logs for amx_ss
 
Quote:

Originally Posted by Desure (Post 2781107)
i have this plugin already amxx, maybe i have to delete it and compile that sma? i only edit sma file, i let old amxx file there

so the plugin that i gave you should magically appear in your server? i think this is the funniest thing i heard in 1.6 community.

you can save you scripting file with sma in your computer, no reason to let them there only if you don t want them in your pc. plugins that are running on your server are in "plugins" file. but not all of them, only those are in plugins.ini from "configs" folder


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

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