Remove time for BOT

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Заключено
Аватар
lantimilan
Извън линия
Foreigner
Foreigner
Мнения: 372
Регистриран на: 29 Ное 2017, 22:49
Се отблагодари: 22 пъти
Получена благодарност: 2 пъти
Обратна връзка:

Remove time for BOT

Мнение от lantimilan » 14 Яну 2020, 10:52

Hello i find this plugin in google but problem is and bot make time i dont like bot to have time just player

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <sqlx>
#pragma compress 1

#pragma tabsize 0
#define S_MINUTE 60
#define S_HOUR 3600
#define S_DAY 86400
#define MAX_TOP 10

//Для ранка
new Array:Player_NameRank;
#define MAX_BUFFER_LENGTH       1536
new g_szMotd[MAX_BUFFER_LENGTH+1]
static Rank_Array_Count;
new bool:IsTopOnline[33];
new OnlineTimeRank[33];
new OnlineTime[33];
new g_szAuthID[33][64];
new Handle:g_SqlTuple
new g_Error[512]
new const szTableName[] = "ls_time" //Название таблицы

//Данные от бд
new const szDBHost[] = ""			// Хост
new const szDBUser[] = ""			//Пользователь
new const szDBPass[] = ""			//Пароль от бд
new const szBDName[] = "" 	//название бд

//нативы
native online_is_top_player(idplayer)
native online_level_player(idplayer)
native online_rank_player(idplayer)
#define DESIGN_STYLE "<meta charset=UTF-8><style>body{background:#112233;font-family:Arial}th{background:#558866;color:#FFF;padding:5px 2px;text-align:left}td{padding:2px 1px}table{background:#EEEECC;font-size:14px;font-family:Arial}h2,h3{color:#FFF;font-family:Verdana}</style>"
public plugin_init() 
{
	register_plugin("Levela Time","0.1","sp2-c-s.ru")
	register_clcmd("say /lstop","cmdalltime")
	register_clcmd("say /lsoret","cmdtime")
	register_clcmd("say /time","cmdtime")
	register_clcmd("say /oret","cmdtime")
	register_clcmd("say /lsrank","CmdRank")
	//sqlite(поставьте // и заполните данные бд
	SQL_SetAffinity( "sqlite" );
	set_task(1.0, "Sql_Init")
}

public Sql_Init()
{
    g_SqlTuple = SQL_MakeDbTuple( szDBHost, szDBUser, szDBPass, szBDName );
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
    if(SqlConnection == Empty_Handle)
        set_fail_state(g_Error)
       
    new Handle:Queries
	new szSendQuery[100];
	format(szSendQuery,99,"CREATE TABLE IF NOT EXISTS %s (name varchar(64),time INT(11))",szTableName)
	Queries = SQL_PrepareQuery(SqlConnection,szSendQuery)
    if(!SQL_Execute(Queries))
    {
        SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        set_fail_state(g_Error)   
    }
    SQL_FreeHandle(Queries)   
    SQL_FreeHandle(SqlConnection)  
	MakeTop( )
	MakeRank( )
}
public MakeTop( )
{	
	new szQuery[ 512 ]
	formatex( szQuery, charsmax( szQuery ),
	"SELECT name,time FROM %s ORDER BY time DESC LIMIT 10",szTableName )
	SQL_ThreadQuery( g_SqlTuple, "MakeTop_QueryHandler", szQuery )
}
public MakeRank( )
{	
	new szQuery[ 512 ]
	formatex( szQuery, charsmax( szQuery ),
	"SELECT name,time FROM %s ORDER BY time DESC LIMIT (SELECT COUNT(*) FROM `%s`)",szTableName,szTableName )
	SQL_ThreadQuery( g_SqlTuple, "MakeRank_QueryHandler", szQuery )
}
public MakeTop_QueryHandler( FailState, Handle:Query, Error[ ], Errcode, Data[ ], DataSize )
{
	if( !SQL_IsFail( FailState, Errcode, Error ) )
	{
		new szName[ 64 ]
		new iLen
		new lPlace[60], lLevel[30],lNick[30],lTime[30];
		format(lPlace, 59, "LS Online")
		format(lNick, 29, "Emri")
		replace_all(lNick, 29, " ", "&nbsp")
		format(lTime, 29, "Koha")
		replace_all(lTime, 29, " ", "&nbsp")
		format(lLevel, 29, "Leveli")
		replace_all(lLevel, 29, " ", "&nbsp")
		iLen = format_all_themes(g_szMotd, iLen)
		iLen += format(g_szMotd[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lPlace)
		iLen += format(g_szMotd[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s</tr>", "Vendi", lNick,lTime,lLevel)
		new Time,Level,szTime[44];
		new i = 1
		while( SQL_MoreResults( Query ) )
		{
			SQL_ReadResult( Query, 0, szName, charsmax( szName ) )
			Time = SQL_ReadResult( Query, 1 )
			Level = get_lvl_player(Time)
			get_human_time(Time,szTime,sizeof(szTime)-1)
			replace_all( szName, charsmax( szName ), "<", "[" )
			replace_all( szName, charsmax( szName ), ">", "]" )
			iLen += formatex(g_szMotd[iLen], charsmax( g_szMotd ) - iLen, "<tr><td>%d</td><td>%s</td><td>%s</td><td>%d</td></td></tr>", (i), szName,szTime,Level)
			i++
			SQL_NextRow( Query )
		}	
	}
}
public MakeRank_QueryHandler( FailState, Handle:Query, Error[ ], Errcode, Data[ ], DataSize )
{
	if( !SQL_IsFail( FailState, Errcode, Error ) )
	{
		new szName[ 64 ]
		while( SQL_MoreResults( Query ) )
		{
			SQL_ReadResult( Query, 0, szName, charsmax( szName ) )
			ArrayPushString(Player_NameRank, szName)
			SQL_NextRow( Query )
		}	
	}
	Rank_Array_Count = ArraySize(Player_NameRank)
}

public	plugin_natives ( )
{
    register_native("online_level_player", "native_online_level_player", 1)
	register_native("online_is_top_player", "native_online_is_top_player", 1)
	register_native("online_rank_player", "native_online_rank_player", 1)
}
public native_online_rank_player(idPlayer)
	return OnlineTimeRank[idPlayer];
	
public native_online_is_top_player(idPlayer)
	return IsTopOnline[idPlayer];
	
public native_online_level_player(idPlayer)
{
	new level = get_lvl_player(OnlineTime[idPlayer]);
	return level;
}
public plugin_precache()
	Player_NameRank	=	ArrayCreate(64, 1);
	

public plugin_end()
	 SQL_FreeHandle(g_SqlTuple)
	
public CmdRank(id)
{
	new szMsg[128];
	formatex(szMsg,charsmax(szMsg),"!y[!gLS Info!y] !tLeveli Juaj: !g%d !yprej !g%d !tLojtareve",OnlineTimeRank[id],Rank_Array_Count)
	ColoredPrint(id, szMsg); 
	return PLUGIN_HANDLED;
}
public client_putinserver(id)
{
	g_szAuthID[id] = ""
	get_user_name(id,g_szAuthID[id],63)
	OnlineTime[id] = 0;
	OnlineTimeRank[id] = 0;
	IsTopOnline[id] = false;
	replace_all(g_szAuthID[id], 63, ":", " ")
	replace_all(g_szAuthID[id], 63, ")", " ")
	replace_all(g_szAuthID[id], 63, "(", " ")
	replace_all(g_szAuthID[id], 63, "^"", " ")
	replace_all(g_szAuthID[id], 63, "%", " ")
	replace_all(g_szAuthID[id], 63, "@", " ")
	replace_all(g_szAuthID[id], 63, "/", " ")
	Load_MySql(id)
	for (new i; i < Rank_Array_Count; i++)
    {
		new Name[64];
        ArrayGetString(Player_NameRank,i, Name, charsmax(Name));
        if(equali(Name,g_szAuthID[id]))
		{
			OnlineTimeRank[id] = i + 1;
			if(i+1<=MAX_TOP)IsTopOnline[id] = true;
			break;
		}
	}
}
public client_disconnect(id)
	Save_MySql(id)
	
public cmdtime(id)
{
	new thetime[64],szMsg[128],level;
	new time = OnlineTime[id] + get_user_time(id)
	get_human_time(time,thetime,sizeof(thetime)-1)
	level = get_lvl_player(time)	
	formatex(szMsg,charsmax(szMsg),"!y[!gLS Info!y] !tKoha Juaj !g%s !tLeveli Juaj !g%d",thetime,level)
	ColoredPrint(id, szMsg); 
	return PLUGIN_HANDLED;
}
public cmdalltime(id)
{
	new szMotdTitle[126];
	formatex(szMotdTitle, charsmax(szMotdTitle),"LS Aktiviteti");
	show_motd(id, g_szMotd, szMotdTitle);	
	return PLUGIN_CONTINUE
}
get_lvl_player(time)
{
	new level,h;
	h=time/S_HOUR;
	level = h / 2	
	return level;
}
get_human_time(time,output[],len)
{
	new m,h,d
	if(time)formatex(output,len,"%d Sek",time) // gg
	if(time/S_MINUTE)
	{
		m=time/S_MINUTE
		formatex(output,len,"%d Min.",m)
	}
	if(time/S_HOUR)
	{
		h=time/S_HOUR
		m=(time-(h*S_HOUR))/S_MINUTE 
		new szHour[16];
		switch(h)
		{
			case 1,21:format(szHour,charsmax(szHour),"Ore")
			case 2..4,22..24:format(szHour,charsmax(szHour),"Ore")
			case 5..20:format(szHour,charsmax(szHour),"Ore")
		}
		formatex(output,len,"%d %s dhe %d Min",h,szHour,m)
	}
	if(time/S_DAY)
	{
		d=time/S_DAY
		h=(time-(d*S_DAY))/S_HOUR
		new szHour[16],szDay[16];
		switch(h)
		{
			case 1,21:format(szHour,charsmax(szHour),"Ore")
			case 2..4,22..24:format(szHour,charsmax(szHour),"Ore")
			case 5..20:format(szHour,charsmax(szHour),"Ore")
		}
		switch(d)
		{
			case 1,21,31:format(szDay,charsmax(szDay),"Dite")
			case 2..4,22..24:format(szDay,charsmax(szDay),"Dite")
			case 5..20,25..30:format(szDay,charsmax(szDay),"Dite")
		}
		formatex(output,len,"%d %s %d %s %d Min.", d,szDay,h,szHour,m)
	}	
}
format_all_themes(sBuffer[MAX_BUFFER_LENGTH + 1], iLen)
{
	//switch
	//{
	iLen = format(sBuffer, MAX_BUFFER_LENGTH, DESIGN_STYLE)	
	return iLen
	//}
}
//stock
//ColorChat
stock ColoredPrint(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[512]
    vformat(msg, 512, input, 3)
    
    replace_all(msg, 512, "!g", "^x04")
    replace_all(msg, 512, "!y", "^x01")
    replace_all(msg, 512, "!t", "^x03")
    
    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
public Load_MySql(id)
{
    new szTemp[512]
    new Data[1]
    Data[0] = id  
    format(szTemp,charsmax(szTemp),"SELECT * FROM `%s` WHERE (`%s`.`name` = '%s')",szTableName,szTableName,g_szAuthID[id])
    SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
}
public Save_MySql(id)
{
    new szTemp[512];
    format(szTemp,charsmax(szTemp),"UPDATE `%s` SET `time` = '%i' WHERE `%s`.`name` = '%s';",szTableName,OnlineTime[id] + get_user_time(id),szTableName,g_szAuthID[id])
    SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
}
public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(FailState == TQUERY_CONNECT_FAILED)
    {
        log_amx("Ngarkuar - Nuk mund te lidhet me SQL database.  [%d] %s", Errcode, Error)
    }
    else if(FailState == TQUERY_QUERY_FAILED)
    {
        log_amx("Load Query deshtoi. [%d] %s", Errcode, Error)
    }

    new id
    id = Data[0]
    
    if(SQL_NumResults(Query) < 1) 
    {
        new szTemp[512]  
        format(szTemp,charsmax(szTemp),"INSERT INTO `%s` ( `name` , `time`)VALUES ('%s','0');",szTableName,g_szAuthID[id])
        SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    } 
    else 
    {
        OnlineTime[id] = SQL_ReadResult(Query, 1)
    }  
    return PLUGIN_HANDLED
}
public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    SQL_FreeHandle(Query)   
    return PLUGIN_HANDLED
}
SQL_IsFail( FailState, Errcode, Error[ ] )
{
	if( FailState == TQUERY_CONNECT_FAILED )
	{
		log_amx( "[Gabim] Nuk mund te lidhet me SQL database: %s", Error )
		return true
	}
	
	if( FailState == TQUERY_QUERY_FAILED )
	{
		log_amx( "[Gabim] Query deshtoi: %s", Error )
		return true
	}
	
	if( Errcode )
	{
		log_amx( "[Gabim] Problem ne query: %s", Error )
		return true
	}
	
	return false
}

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 6459
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 114 пъти
Получена благодарност: 862 пъти
Обратна връзка:

Remove time for BOT

Мнение от OciXCrom » 14 Яну 2020, 14:57

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <sqlx>
#pragma compress 1

#pragma tabsize 0
#define S_MINUTE 60
#define S_HOUR 3600
#define S_DAY 86400
#define MAX_TOP 10

//Для ранка
new Array:Player_NameRank;
#define MAX_BUFFER_LENGTH       1536
new g_szMotd[MAX_BUFFER_LENGTH+1]
static Rank_Array_Count;
new bool:IsTopOnline[33];
new OnlineTimeRank[33];
new OnlineTime[33];
new g_szAuthID[33][64];
new Handle:g_SqlTuple
new g_Error[512]
new const szTableName[] = "ls_time" //Название таблицы

//Данные от бд
new const szDBHost[] = ""			// Хост
new const szDBUser[] = ""			//Пользователь
new const szDBPass[] = ""			//Пароль от бд
new const szBDName[] = "" 	//название бд

//нативы
native online_is_top_player(idplayer)
native online_level_player(idplayer)
native online_rank_player(idplayer)
#define DESIGN_STYLE "<meta charset=UTF-8><style>body{background:#112233;font-family:Arial}th{background:#558866;color:#FFF;padding:5px 2px;text-align:left}td{padding:2px 1px}table{background:#EEEECC;font-size:14px;font-family:Arial}h2,h3{color:#FFF;font-family:Verdana}</style>"
public plugin_init()
{
	register_plugin("Levela Time","0.1","sp2-c-s.ru")
	register_clcmd("say /lstop","cmdalltime")
	register_clcmd("say /lsoret","cmdtime")
	register_clcmd("say /time","cmdtime")
	register_clcmd("say /oret","cmdtime")
	register_clcmd("say /lsrank","CmdRank")
	//sqlite(поставьте // и заполните данные бд
	SQL_SetAffinity( "sqlite" );
	set_task(1.0, "Sql_Init")
}

public Sql_Init()
{
    g_SqlTuple = SQL_MakeDbTuple( szDBHost, szDBUser, szDBPass, szBDName );
    new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
    if(SqlConnection == Empty_Handle)
        set_fail_state(g_Error)

    new Handle:Queries
	new szSendQuery[100];
	format(szSendQuery,99,"CREATE TABLE IF NOT EXISTS %s (name varchar(64),time INT(11))",szTableName)
	Queries = SQL_PrepareQuery(SqlConnection,szSendQuery)
    if(!SQL_Execute(Queries))
    {
        SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        set_fail_state(g_Error)
    }
    SQL_FreeHandle(Queries)
    SQL_FreeHandle(SqlConnection)
	MakeTop( )
	MakeRank( )
}
public MakeTop( )
{
	new szQuery[ 512 ]
	formatex( szQuery, charsmax( szQuery ),
	"SELECT name,time FROM %s ORDER BY time DESC LIMIT 10",szTableName )
	SQL_ThreadQuery( g_SqlTuple, "MakeTop_QueryHandler", szQuery )
}
public MakeRank( )
{
	new szQuery[ 512 ]
	formatex( szQuery, charsmax( szQuery ),
	"SELECT name,time FROM %s ORDER BY time DESC LIMIT (SELECT COUNT(*) FROM `%s`)",szTableName,szTableName )
	SQL_ThreadQuery( g_SqlTuple, "MakeRank_QueryHandler", szQuery )
}
public MakeTop_QueryHandler( FailState, Handle:Query, Error[ ], Errcode, Data[ ], DataSize )
{
	if( !SQL_IsFail( FailState, Errcode, Error ) )
	{
		new szName[ 64 ]
		new iLen
		new lPlace[60], lLevel[30],lNick[30],lTime[30];
		format(lPlace, 59, "LS Online")
		format(lNick, 29, "Emri")
		replace_all(lNick, 29, " ", "&nbsp")
		format(lTime, 29, "Koha")
		replace_all(lTime, 29, " ", "&nbsp")
		format(lLevel, 29, "Leveli")
		replace_all(lLevel, 29, " ", "&nbsp")
		iLen = format_all_themes(g_szMotd, iLen)
		iLen += format(g_szMotd[iLen], MAX_BUFFER_LENGTH - iLen, "<body><h2>%s</h2> <table width=100%% border=0 align=center cellpadding=0 cellspacing=1>", lPlace)
		iLen += format(g_szMotd[iLen], MAX_BUFFER_LENGTH - iLen, "<tr><th>%s<th>%s<th>%s<th>%s</tr>", "Vendi", lNick,lTime,lLevel)
		new Time,Level,szTime[44];
		new i = 1
		while( SQL_MoreResults( Query ) )
		{
			SQL_ReadResult( Query, 0, szName, charsmax( szName ) )
			Time = SQL_ReadResult( Query, 1 )
			Level = get_lvl_player(Time)
			get_human_time(Time,szTime,sizeof(szTime)-1)
			replace_all( szName, charsmax( szName ), "<", "[" )
			replace_all( szName, charsmax( szName ), ">", "]" )
			iLen += formatex(g_szMotd[iLen], charsmax( g_szMotd ) - iLen, "<tr><td>%d</td><td>%s</td><td>%s</td><td>%d</td></td></tr>", (i), szName,szTime,Level)
			i++
			SQL_NextRow( Query )
		}
	}
}
public MakeRank_QueryHandler( FailState, Handle:Query, Error[ ], Errcode, Data[ ], DataSize )
{
	if( !SQL_IsFail( FailState, Errcode, Error ) )
	{
		new szName[ 64 ]
		while( SQL_MoreResults( Query ) )
		{
			SQL_ReadResult( Query, 0, szName, charsmax( szName ) )
			ArrayPushString(Player_NameRank, szName)
			SQL_NextRow( Query )
		}
	}
	Rank_Array_Count = ArraySize(Player_NameRank)
}

public	plugin_natives ( )
{
    register_native("online_level_player", "native_online_level_player", 1)
	register_native("online_is_top_player", "native_online_is_top_player", 1)
	register_native("online_rank_player", "native_online_rank_player", 1)
}
public native_online_rank_player(idPlayer)
	return OnlineTimeRank[idPlayer];

public native_online_is_top_player(idPlayer)
	return IsTopOnline[idPlayer];

public native_online_level_player(idPlayer)
{
	new level = get_lvl_player(OnlineTime[idPlayer]);
	return level;
}
public plugin_precache()
	Player_NameRank	=	ArrayCreate(64, 1);


public plugin_end()
	 SQL_FreeHandle(g_SqlTuple)

public CmdRank(id)
{
	new szMsg[128];
	formatex(szMsg,charsmax(szMsg),"!y[!gLS Info!y] !tLeveli Juaj: !g%d !yprej !g%d !tLojtareve",OnlineTimeRank[id],Rank_Array_Count)
	ColoredPrint(id, szMsg);
	return PLUGIN_HANDLED;
}
public client_putinserver(id)
{
	if(is_user_bot(id))
	{
		return
	}

	g_szAuthID[id] = ""
	get_user_name(id,g_szAuthID[id],63)
	OnlineTime[id] = 0;
	OnlineTimeRank[id] = 0;
	IsTopOnline[id] = false;
	replace_all(g_szAuthID[id], 63, ":", " ")
	replace_all(g_szAuthID[id], 63, ")", " ")
	replace_all(g_szAuthID[id], 63, "(", " ")
	replace_all(g_szAuthID[id], 63, "^"", " ")
	replace_all(g_szAuthID[id], 63, "%", " ")
	replace_all(g_szAuthID[id], 63, "@", " ")
	replace_all(g_szAuthID[id], 63, "/", " ")
	Load_MySql(id)
	for (new i; i < Rank_Array_Count; i++)
    {
		new Name[64];
        ArrayGetString(Player_NameRank,i, Name, charsmax(Name));
        if(equali(Name,g_szAuthID[id]))
		{
			OnlineTimeRank[id] = i + 1;
			if(i+1<=MAX_TOP)IsTopOnline[id] = true;
			break;
		}
	}
}
public client_disconnect(id)
{
	if(is_user_bot(id))
	{
		return
	}

	Save_MySql(id)
}

public cmdtime(id)
{
	new thetime[64],szMsg[128],level;
	new time = OnlineTime[id] + get_user_time(id)
	get_human_time(time,thetime,sizeof(thetime)-1)
	level = get_lvl_player(time)
	formatex(szMsg,charsmax(szMsg),"!y[!gLS Info!y] !tKoha Juaj !g%s !tLeveli Juaj !g%d",thetime,level)
	ColoredPrint(id, szMsg);
	return PLUGIN_HANDLED;
}
public cmdalltime(id)
{
	new szMotdTitle[126];
	formatex(szMotdTitle, charsmax(szMotdTitle),"LS Aktiviteti");
	show_motd(id, g_szMotd, szMotdTitle);
	return PLUGIN_CONTINUE
}
get_lvl_player(time)
{
	new level,h;
	h=time/S_HOUR;
	level = h / 2
	return level;
}
get_human_time(time,output[],len)
{
	new m,h,d
	if(time)formatex(output,len,"%d Sek",time) // gg
	if(time/S_MINUTE)
	{
		m=time/S_MINUTE
		formatex(output,len,"%d Min.",m)
	}
	if(time/S_HOUR)
	{
		h=time/S_HOUR
		m=(time-(h*S_HOUR))/S_MINUTE
		new szHour[16];
		switch(h)
		{
			case 1,21:format(szHour,charsmax(szHour),"Ore")
			case 2..4,22..24:format(szHour,charsmax(szHour),"Ore")
			case 5..20:format(szHour,charsmax(szHour),"Ore")
		}
		formatex(output,len,"%d %s dhe %d Min",h,szHour,m)
	}
	if(time/S_DAY)
	{
		d=time/S_DAY
		h=(time-(d*S_DAY))/S_HOUR
		new szHour[16],szDay[16];
		switch(h)
		{
			case 1,21:format(szHour,charsmax(szHour),"Ore")
			case 2..4,22..24:format(szHour,charsmax(szHour),"Ore")
			case 5..20:format(szHour,charsmax(szHour),"Ore")
		}
		switch(d)
		{
			case 1,21,31:format(szDay,charsmax(szDay),"Dite")
			case 2..4,22..24:format(szDay,charsmax(szDay),"Dite")
			case 5..20,25..30:format(szDay,charsmax(szDay),"Dite")
		}
		formatex(output,len,"%d %s %d %s %d Min.", d,szDay,h,szHour,m)
	}
}
format_all_themes(sBuffer[MAX_BUFFER_LENGTH + 1], iLen)
{
	//switch
	//{
	iLen = format(sBuffer, MAX_BUFFER_LENGTH, DESIGN_STYLE)
	return iLen
	//}
}
//stock
//ColorChat
stock ColoredPrint(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[512]
    vformat(msg, 512, input, 3)

    replace_all(msg, 512, "!g", "^x04")
    replace_all(msg, 512, "!y", "^x01")
    replace_all(msg, 512, "!t", "^x03")

    if (id) players[0] = id; else get_players(players, count, "ch")
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
public Load_MySql(id)
{
    new szTemp[512]
    new Data[1]
    Data[0] = id
    format(szTemp,charsmax(szTemp),"SELECT * FROM `%s` WHERE (`%s`.`name` = '%s')",szTableName,szTableName,g_szAuthID[id])
    SQL_ThreadQuery(g_SqlTuple,"register_client",szTemp,Data,1)
}
public Save_MySql(id)
{
    new szTemp[512];
    format(szTemp,charsmax(szTemp),"UPDATE `%s` SET `time` = '%i' WHERE `%s`.`name` = '%s';",szTableName,OnlineTime[id] + get_user_time(id),szTableName,g_szAuthID[id])
    SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
}
public register_client(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(FailState == TQUERY_CONNECT_FAILED)
    {
        log_amx("Ngarkuar - Nuk mund te lidhet me SQL database.  [%d] %s", Errcode, Error)
    }
    else if(FailState == TQUERY_QUERY_FAILED)
    {
        log_amx("Load Query deshtoi. [%d] %s", Errcode, Error)
    }

    new id
    id = Data[0]

    if(SQL_NumResults(Query) < 1)
    {
        new szTemp[512]
        format(szTemp,charsmax(szTemp),"INSERT INTO `%s` ( `name` , `time`)VALUES ('%s','0');",szTableName,g_szAuthID[id])
        SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
    }
    else
    {
        OnlineTime[id] = SQL_ReadResult(Query, 1)
    }
    return PLUGIN_HANDLED
}
public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    SQL_FreeHandle(Query)
    return PLUGIN_HANDLED
}
SQL_IsFail( FailState, Errcode, Error[ ] )
{
	if( FailState == TQUERY_CONNECT_FAILED )
	{
		log_amx( "[Gabim] Nuk mund te lidhet me SQL database: %s", Error )
		return true
	}

	if( FailState == TQUERY_QUERY_FAILED )
	{
		log_amx( "[Gabim] Query deshtoi: %s", Error )
		return true
	}

	if( Errcode )
	{
		log_amx( "[Gabim] Problem ne query: %s", Error )
		return true
	}

	return false
}

Аватар
lantimilan
Извън линия
Foreigner
Foreigner
Мнения: 372
Регистриран на: 29 Ное 2017, 22:49
Се отблагодари: 22 пъти
Получена благодарност: 2 пъти
Обратна връзка:

Remove time for BOT

Мнение от lantimilan » 14 Яну 2020, 19:48

Thanks OciXCrom :D

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Google [Bot] и 9 госта