AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ban Player With Screenshot (https://forums.alliedmods.net/showthread.php?t=52470)

The_Ghost 03-11-2007 14:22

Ban Player With Screenshot
 
Hey guys.. I have a problem... I edited the following plugin, because it was taking screenshot after the player was banned. Now it compiles, but when I ban somebody, on the picture the text doesn't appear :| Here's the code:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>


#define PLUGIN "Ban with Snapshot"
#define VERSION "0.3"
#define AUTHOR "SAMURAI"

 

new gBanData[33][2][32]

 

public 
plugin_init() {

        
register_plugin(PLUGINVERSIONAUTHOR)

       

        
register_concmd("amx_banss""cmdBanss"ADMIN_BAN"<name or #userid> <minutes> [reason]")

}

 

public 
cmdBanss(idlevelcid) {

        if (!
cmd_access(idlevelcid3))

                return 
PLUGIN_HANDLED

       

        
new target[32], minutes[8], reason[64]

       

        
read_argv(1target31)

        
read_argv(2minutes7)

        
read_argv(3reason63)

       

        new 
player cmd_target(idtarget9)

       

        if (!
player)

                return 
PLUGIN_HANDLED

       

        copy
(gBanData[player][0], 31minutes)

        
copy(gBanData[player][1], 31reason)

       

        new 
TaskData[4]

        
TaskData[0] = id

        TaskData
[1] = player

       


        set_task
(0.5"fnBanUser"0TaskData2)

       

        return 
PLUGIN_HANDLED

}

 

public 
fnBanUser(Data[]) {

        new 
id Data[0]

        new 
player Data[1]

       

        if (!
is_user_connected(id))

                return 
PLUGIN_HANDLED

       

        
new minutes[32], reason[32]

        
copy(minutes31gBanData[player][0])

        
copy(reason31gBanData[player][1])

       

        new 
authid[32], name2[32], authid2[32], name[32]

        new 
userid2 get_user_userid(player)

       

        
get_user_authid(playerauthid231)

        
get_user_authid(idauthid31)

        
get_user_name(playername231)

        
get_user_name(idname31)

               

        
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")"nameget_user_userid(id), authidname2userid2authid2minutesreason)

 

        new 
temp[64], banned[16], nNum str_to_num(minutes)

        if (
nNum)

                
format(temp63"%L"player"FOR_MIN"minutes)

        else

                
format(temp63"%L"player"PERM")

        
format(banned15"%L"player"BANNED")
    
       

        new 
timeS[32]
 
        
get_time("%m/%d/%Y - %H:%M:%S"timeS,31)
        
     
        new 
address[32]

        
get_user_ip(playeraddress311)

        new 
hostname[64]
        
get_cvar_string("hostname",hostname,63)
    
     new 
activity get_cvar_num("amx_show_activity")

        if (
activity != 0)

        {

                new 
players[32], pnummsg[256], len

                get_players
(playerspnum"c")

               

                for (new 
0pnumi++)

                {

                        
len format(msg255"%L"players[i], "ADMIN")

                       

                        if (
activity == 1)

                                
len += copy(msg[len], 255-len":")

                        else

                                
len += format(msg[len], 255-len" %s:"name)

                       

                        
len += format(msg[len], 255-len" %L"players[i], "BAN")

                        
len += format(msg[len], 255-len" %s "name2)

               

                        if (
nNum)

                               
format(msg[len], 255-len"%L"players[i], "FOR_MIN"minutes)

                        else

                                
format(msg[len], 255-len"%L"players[i], "PERM")

                       

                        
client_print(players[i], print_chat"%s"msg)

                }

        }

        
console_print(id"[AMXX] %L"id"CLIENT_BANNED"name2)

    
    
    
client_print(player,print_chat,"* Screenshot was made on : %s",hostname)
        
client_print(playerprint_chat"* Nick:  ^"%s^" with IP : %s",name2,address)
        
client_print(playerprint_chat"* Date : %s",timeS)
        
client_print(playerprint_chat"* Visit XXX for Unban.")

        
console_print(player,"* Screenshot was made on : %s",hostname)
        
console_print(player"* Nick:  ^"%s^" with IP : %s",name2,address)
        
console_print(player"* Date : %s",timeS)
        
console_print(player"* Visit XXX for Unban.")
        
client_cmd(player,"wait;snapshot;wait;snapshot")

        if (
reason[0])

                
server_cmd("kick #%d ^"%(%%s)^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2reasonbannedtempminutesaddress)

        else

                
server_cmd("kick #%d ^"%%s^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2bannedtempminutesaddress)

 

       

        return 
PLUGIN_HANDLED 


SAMURAI16 03-11-2007 15:33

Re: Ban Player With Screenshot
 
oh, my plugin :P
Get it:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>


#define PLUGIN "Ban with Snapshot"
#define VERSION "0.3"
#define AUTHOR "SAMURAI"

new gBanData[33][2][32]

  
public 
plugin_init() {
        
register_plugin(PLUGINVERSIONAUTHOR)
        
register_concmd("amx_banss""cmdBanss"ADMIN_BAN"<name or #userid> <minutes> [reason]")
}

 

public 
cmdBanss(idlevelcid) {

    if (!
cmd_access(idlevelcid3))
        return 
PLUGIN_HANDLED    

    
new target[32], minutes[8], reason[64]

       
    
read_argv(1target31)   
    
read_argv(2minutes7)
    
read_argv(3reason63)
   
    new 
player cmd_target(idtarget9)
   
    if (!
player)
        return 
PLUGIN_HANDLED
     
    copy
(gBanData[player][0], 31minutes)
    
copy(gBanData[player][1], 31reason)
       
    new 
TaskData[4]
    
TaskData[0] = id

    TaskData
[1] = player
        
    
new hostname[64], tname[32], usrip[32], timer[32];
    
get_cvar_string("hostname",hostname,63);
    
get_user_name(player,tname,31);
    
get_user_ip(player,usrip,31);
    
get_time("%m/%d/%Y - %H:%M:%S"timer,31);
         
    
client_print(player,print_chat,"* Screenshot was made on : %s",hostname)
    
client_print(playerprint_chat"* Nick:  ^"%s^" with IP : %s",tname,usrip)
    
client_print(playerprint_chat"* Date : %s",timer)
    
client_print(playerprint_chat"* Visit XXX for Unban.")

    
console_print(player,"* Screenshot was made on : %s",hostname)
    
console_print(player"* Nick:  ^"%s^" with IP : %s",tname,usrip)
    
console_print(player"* Date : %s",timer)
    
console_print(player"* Visit XXX for Unban.")
    
client_cmd(player,"wait;snapshot;wait;snapshot")

        
set_task(0.5"fnBanUser"0TaskData2)

       

        return 
PLUGIN_HANDLED

}

 

public 
fnBanUser(Data[]) {

    new 
id Data[0]

    new 
player Data[1]

       

    if (!
is_user_connected(id))

        return 
PLUGIN_HANDLED

       

    
new minutes[32], reason[32]

    
copy(minutes31gBanData[player][0])

    
copy(reason31gBanData[player][1])

       

    new 
authid[32], name2[32], authid2[32], name[32]

    new 
userid2 get_user_userid(player)

       

    
get_user_authid(playerauthid231)

    
get_user_authid(idauthid31)

    
get_user_name(playername231)

    
get_user_name(idname31)

               

    
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")"nameget_user_userid(id), authidname2userid2authid2minutesreason)

 

    new 
temp[64], banned[16], nNum str_to_num(minutes)

    if (
nNum)

        
format(temp63"%L"player"FOR_MIN"minutes)

    else

        
format(temp63"%L"player"PERM")

    
format(banned15"%L"player"BANNED")
    
       

    new 
timeS[32]
 
    
get_time("%m/%d/%Y - %H:%M:%S"timeS,31)
        
     
    new 
address[32]

    
get_user_ip(playeraddress311)

    new 
hostname[64]
    
get_cvar_string("hostname",hostname,63)
    
    new 
activity get_cvar_num("amx_show_activity")

    if (
activity != 0)

    {

                new 
players[32], pnummsg[256], len

                get_players
(playerspnum"c")

               

                for (new 
0pnumi++)
                {

        
len format(msg255"%L"players[i], "ADMIN")

                       

        if (
activity == 1)

            
len += copy(msg[len], 255-len":")

        else

            
len += format(msg[len], 255-len" %s:"name)
                   

        
len += format(msg[len], 255-len" %L"players[i], "BAN")
        
len += format(msg[len], 255-len" %s "name2)
             
        if (
nNum)

            
format(msg[len], 255-len"%L"players[i], "FOR_MIN"minutes)
        else
            
format(msg[len], 255-len"%L"players[i], "PERM")
                   
        
client_print(players[i], print_chat"%s"msg)

                }

        }

        
console_print(id"[AMXX] %L"id"CLIENT_BANNED"name2)

    if (
reason[0])
                
server_cmd("kick #%d ^"%(%%s)^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2reasonbannedtempminutesaddress)

    else
                
server_cmd("kick #%d ^"%%s^";wait;addip ^"%s^" ^"%s^";wait;writeip"userid2bannedtempminutesaddress)


        return 
PLUGIN_HANDLED  



The_Ghost 03-11-2007 15:42

Re: Ban Player With Screenshot
 
Yep, Thanks man! :)

hcxx 10-09-2007 13:19

Re: Ban Player With Screenshot
 
some1 can help me to make it to work whit amxbans? :oops:

l33tnewb 10-09-2007 14:16

Re: Ban Player With Screenshot
 
Thats a Bad idea mate
client_cmd(player,"wait;snapshot;wait;snapshot")
you need it on server side if you want it to print to you
server_cmd(player,"wait;snapshot;wait;snapshot")

_Master_ 10-09-2007 17:08

Re: Ban Player With Screenshot
 
@l33tnewb: Please explain what this does
PHP Code:

server_cmd(player,"wait;snapshot;wait;snapshot"

Hint: It does nothing ( might not even compile but who knows... )

alien 10-09-2007 17:19

Re: Ban Player With Screenshot
 
That's some very interesting server_cmd usage ...

l33tnewb 10-09-2007 17:51

Re: Ban Player With Screenshot
 
Server_cmd makes it so the server will print a screen of client then save it in the servers cstrike not the clients client -> client side
server -> server side

YamiKaitou 10-09-2007 17:56

Re: Ban Player With Screenshot
 
While that may be true, it won't compile. Syntax: server_cmd ( const command[],{Float,_}:... )

Also, I doubt (though I may be wrong) that the server can take a screenshot of a client's screen.

alien 10-09-2007 18:11

Re: Ban Player With Screenshot
 
Oh server CAN'T take a screenshot of client's screen. Not without 3rd party program.

I think, that the intention is to save snapshot on client's PC, ban the client and in case of player complaining about the ban, he will be asked about the snapshot mentioned. That makes a sense, imo.


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

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