Raised This Month: $ Target: $400
 0% 

Problem with ban reason


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
^^KaMaZZ~.^
Junior Member
Join Date: Jan 2009
Old 02-05-2009 , 13:45   Problem with ban reason
Reply With Quote #1

I have a problem with a ban reason, i have a AMXBans.
I need to have these reason: Wrzuc screenshoty na FragArena.xx
But, if player is have name with a space, reason have part of these player name.
Quote:
player name: player
reason: Wrzuc screenshoty na FragArena.xx

player name: player 2
reason: 2 Wrzuc screenshoty na FragArena.xx
Srry, my english is ulow

PHP Code:
// #define USING_SQL

#include <amxmodx>
#include <amxmisc>
#if defined USING_SQL
#include <sqlx>
#endif

#define PLUGIN "amx_screenshot"
#define VERSION "1.0"
#define AUTHOR "KaMaZZ"

#if defined USING_SQL
///SQL
#define table    "screenshot_logs"
#define MAXLEN 511
#define MAX_WORDS 150

// SQL
new Handle:g_SqlX
new Handle:g_SqlConnection
new g_error[512]
#endif

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR)
        
    
register_concmd("amx_screen""screeny"ADMIN_BAN"<nick lub userid gracza>")
    
    
#if defined USING_SQL
        
new host[64], user[64], pass[64], db[64], errorcode
        get_cvar_string
("amx_sql_host"host63)
        
get_cvar_string("amx_sql_user"user63)
        
get_cvar_string("amx_sql_pass"pass63)
        
get_cvar_string("amx_sql_db"db63)

        
g_SqlX SQL_MakeDbTuple(hostuserpassdb)
        
g_SqlConnection SQL_Connect(g_SqlX,errorcode,g_error,511);

        if (!
g_SqlConnection)
        {
            
console_print(0,"Logowanie zdjec: Nie moge polaczyc sie z baza danych.!")
            return 
log_amx("Logowanie zdjec: Nie moge polaczyc sie z baza danych.")
        }

        new 
query_create[1001]
        
format(query_create,1000,"CREATE TABLE IF NOT EXISTS `%s`(`id` int(11) NOT NULL auto_increment,`name` varchar(100) NOT NULL default '',`ip` varchar(100) NOT NULL default '',`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00',`cmd` varchar(100) NOT NULL default '',`adminname` text NOT NULL,PRIMARY KEY  (`id`));",table)
        
SQL_ThreadQuery(g_SqlX,"QueryHandle",query_create)

        
log_amx("Logowanie zdjec: Polaczono do bazy mysql!")
        return 
PLUGIN_CONTINUE
    
#endif
}

public 
screeny(idlevelcid

    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
         
    
// Argument
    
new arg[32]
    
read_argv(1arg31
   
    
// Zmienne
    
new player cmd_target(idarg9)
    
    if (!
player) return PLUGIN_HANDLED
        
    
new name[32]
    
get_user_name(idname31)
    new 
pname[32]
    
get_user_name(playerpname31);
    new 
pip[32
    
get_user_ip(playerpip31);
    
    new 
datestr[11]
    
get_time("%Y.%m.%d"datestr10)
    new 
timestr[9]
    
get_time("%H:%M:%S"timestr8)
    new 
timer[32];
    
get_time("%Y/%m/%d - %H:%M:%S"timer31);
   
    
// Screeny
    
client_print(playerprint_chat"Screenshoty: %s "timer)
    
    
// Konsola
    
console_print(id"** Zrobiles 4 screeny ** 2 bmp || 2 tga ** !")
    
console_print(id"** Godz: %s"timer)
    
console_print(id"** Screeny zrobione przez admina %s"name)
    
console_print(id"** Nick gracza: %s | IP: %s",pnamepip)
    
    
client_print(idprint_chat"** Trwa robienie screenow graczowi %s przez admina %s"pnamename)
    
client_print(idprint_chat"** Wiecej informacji w konsoli")
    
client_print(playerprint_chat"** Trwa robienie screenow graczowi %s przez admina %s"pnamename)
    
client_print(playerprint_chat"** Godz: %s"timer)
    
    
set_task(0.1"screens"player_2"a"2)
    
    
#if defined USING_SQL
        
new query[1001]
        
format(query,1000,"INSERT into %s (name, ip, date, time, adminname) values ('%s','%s','%s','%s','%s')"tablepnamepipdatestrtimestrname)
        
SQL_ThreadQuery(g_SqlX,"QueryHandle",query)
    
#else
        
new dir[128]
        new 
message[256]
        
format(dir127"addons/logi/screeny.log")
        
format(message255"%s  -  Admin: %s <> Nick: %s |  IP: %s"timernamepnamepip)
    
        
write_file(dirmessage)
    
#endif
    
    
new userid2 get_user_userid(id)
    
    new 
reason[64]
    
formatex(reasonsizeof reason 1"Wrzuc screenshoty na FragArena.xx")
    
    
remove_quotes(reason)
    
    
client_cmd(id"amx_banip 0 ^"#%d^" ^"%s^"", userid2, reason)
    
    
return PLUGIN_HANDLED
}

public 
screens(player)
{
    
client_cmd(player,"snapshot")
    
client_cmd(player"wait")
    
client_cmd(player"screenshot")
    
    return 
PLUGIN_HANDLED
}

#if defined USING_SQL
public QueryHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
        return 
log_amx("Logowanie screenow: Nie moge polaczyc sie z SQL.")

    else if(
FailState == TQUERY_QUERY_FAILED)
        return 
log_amx("Logowanie screenow: Zapytanie nieprawidlowe")

    if(
Errcode)
        return 
log_amx("Logowanie screenow: Blad w zapytaniu: %s",Error)

    new 
DataNum
    
while(SQL_MoreResults(Query))
    {
        
DataNum SQL_ReadResult(Query,0)
        
server_print("zomg, some data: %s",DataNum)
        
SQL_NextRow(Query)
    }
    return 
PLUGIN_CONTINUE

#endif 
^^KaMaZZ~.^ 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 01:37.


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