Иконка ресурса

Egor Dolgirev

Участник
Сообщения
8
Реакции
4
  • Автор ресурса
  • #1
Please test plug ( not stable )

Demands: CS:GO; Sourcemod < 1.7.0

Author: @Samil#

Version: Beta test

Description:
Add system rank and different models ( Knife, Gloves, Skins ) for knife server
ConVars:

Path to the download file:
<sm_downpath "addons/sourcemod/configs/knife_rank/downloads.txt">

Give value points for kill
<sm_givevaluepoins "3">

Give value points for death
<sm_getvaluepoins "3">

Limit points for get 1 rank аnd so on
<sm_0_rankpoints "0">

Prefix player 1 rank аnd so on
<sm_patharms_0 "Prefix 1">

Path to model arms 1 аnd so on
<sm_patharms_1 "Path to mdl arms">

Path to model skins 1 аnd so on
<sm_pathskin_1 "Path to mdl skins">

Write me about you problem on plugin

UPDATE

PS:
Please test plug ( not stable )
 
Последнее редактирование модератором:

Felton

Участник
Сообщения
799
Реакции
59
Полная информация по плагину...я и так понял.Предлагаю всем писать только на этом языке.
 

R1KO

fuck society
Сообщения
9,457
Реакции
7,786
  • Команда форума
  • #3
Ой:
PHP:
decl String: s_Name[ 128 ], String: s_Auth[ 32 ], String: s_Query[ PLATFORM_MAX_PATH ]
	GetClientName( i_client, s_Query, sizeof( s_Query ) - 1 ) // Получаешь в  s_Query
	SQL_EscapeString( g_h_Databases, s_Auth, s_Name, sizeof( s_Name ) - 1 ) // А тут юзаешь s_Auth 
	GetClientAuthId( i_client, AuthId_Steam2, s_Auth, sizeof( s_Auth ) )
	FormatEx( s_Query, sizeof( s_Query ) - 1, "INSERT INTO `kniferank_table` (`name`, `auth`) VALUES ('%s', '%s');", s_Name, s_Auth )
	SQL_TQuery( g_h_Databases, SQL_CreateClientCallback, s_Query, GetClientUserId( i_client ) )

- 1 не нужно делать.

PHP:
SaveClient( i_client )
{
	decl String: s_Name[ 128 ], String: s_NameDB[ PLATFORM_MAX_PATH ], String: s_Query[ PLATFORM_MAX_PATH ]
	GetClientName( i_client, s_Name, sizeof( s_Name ) - 1 )
	SQL_EscapeString( g_h_Databases, s_Name, s_NameDB, sizeof( s_NameDB ) - 1 )
	FormatEx( s_Query, sizeof( s_Query ) - 1, "UPDATE `kniferank_table` SET `name` = '%s', `kills` = '%i', `deaths` = '%i', `points` = %i WHERE `id` = '%i';", s_NameDB, g_i_ClientKills[ i_client ], g_i_ClientDeaths[ i_client ], g_i_ClientPoints[ i_client ], g_i_ClientID[ i_client ] )
	SQL_TQuery( g_h_Databases, SQL_SaveClientCallback, s_Query )
}

Здесь чтобы не создавать s_NameDB можно сделать как сделано выше.

PHP:
public Action: Event_PlayerDeath( Handle: h_event, const String: s_name[  ], bool: b_dontBroadcast )
{
	new i_client = GetClientOfUserId( GetEventInt( h_event, ( "userid" ) ) )
	new i_attacker = GetClientOfUserId( GetEventInt( h_event, ( "attacker" ) ) )
	
	if( i_attacker < 1 || !IsClientInGame( i_attacker ) || IsFakeClient( i_attacker ) || i_attacker > MaxClients )
		return
	
	if( i_client < 1 || !IsClientInGame( i_client ) || IsFakeClient( i_client ) )
		return
	
	g_i_ClientDeaths[ i_client ]++
	g_i_ClientPoints[ i_client ] -= g_i_Cvar_GetValuePoints
	
	new i_current1 = CheckRangsClient( i_attacker )
	g_i_ClientKills[ i_attacker ]++
	g_i_ClientPoints[ i_attacker ] += g_i_Cvar_GiveValuePoints
	new i_current2 = CheckRangsClient( i_attacker )
	if ( i_current1 > i_current2 )
		PrintToChat(i_attacker, "Вас повысили в ранге! Текущий ранг: %s", g_s_CurrentRank[ i_attacker ] )
}

1. Action: не нужно
2.
PHP:
if( i_attacker < 1 || !IsClientInGame( i_attacker ) || IsFakeClient( i_attacker ) || i_attacker > MaxClients )
		return
Если игрок умер от падения или его убил бот, то не выполнится:

PHP:
g_i_ClientDeaths[ i_client ]++
	g_i_ClientPoints[ i_client ] -= g_i_Cvar_GetValuePoints

PHP:
public Action: Say( i_client, const String:s_command[  ], i_args  ) 
{
	if( i_client < 1 || !IsClientInGame( i_client ) )
		return Plugin_Continue
		
	decl String: buffer[ PLATFORM_MAX_PATH ], String: s_Name[ 64 ]
	GetCmdArgString( buffer, sizeof( buffer ) )
	new i_teamclient = GetClientTeam( i_client )
	GetClientName( i_client, s_Name, sizeof( s_Name ) )
	StripQuotes( buffer )
	if( !IsPlayerAlive( i_client ) )
	{
		PrintToChatAll( "[ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
		for( new x = 1; x <= MaxClients; x++ )
		{
			if( !IsPlayerAlive( x ) )
				PrintToChat( x, "*Death* [ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
		}
	}
	else if( IsPlayerAlive( i_client ) )
	{
		PrintToChatAll( "[ %s ] %s: %s", g_s_CurrentRank[ i_client ], i_client, buffer )
	}
	else if( i_teamclient == 1 )
	{
		for( new i = 1; i <= MaxClients; i++ )
		{
			new i_teami = GetClientTeam( i )
			if( i_teami == 1 )
				PrintToChat( i, "*Spectator* [ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
		}
	}
	return Plugin_Handled
}

Сделай TrimString и StripQuotes после GetCmdArgString( buffer, sizeof( buffer ) ) чтобы избавиться от "" и пробелов по краям.
в конце лучше вернуть return Plugin_Continue
а при выводе своих сообщений return Plugin_Handled

И так же с say_team
 
Последнее редактирование:
  • Мне нравится
Реакции: TWRP

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
PHP:
public Action: Say( i_client, const String:s_command[  ], i_args  ) 
{
    if( i_client < 1 || !IsClientInGame( i_client ) )
        return Plugin_Continue
decl String: buffer[ PLATFORM_MAX_PATH ], String: s_Name[ 64 ]
    GetCmdArgString( buffer, sizeof( buffer ) )
    new i_teamclient = GetClientTeam( i_client )
    GetClientName( i_client, s_Name, sizeof( s_Name ) )
    StripQuotes( buffer )
    if( !IsPlayerAlive( i_client ) )
    {
        PrintToChatAll( "[ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
        for( new x = 1; x <= MaxClients; x++ )
        {
            if( !IsPlayerAlive( x ) )
                PrintToChat( x, "*Death* [ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
        }
    }
    else if( IsPlayerAlive( i_client ) )
    {
        PrintToChatAll( "[ %s ] %s: %s", g_s_CurrentRank[ i_client ], i_client, buffer )
    }
    else if( i_teamclient == 1 )
    {
        for( new i = 1; i <= MaxClients; i++ )
        {
            new i_teami = GetClientTeam( i )
            if( i_teami == 1 )
                PrintToChat( i, "*Spectator* [ %s ] %s: %s", g_s_CurrentRank[ i_client ], s_Name, buffer )
        }
    }
    return Plugin_Handled
}
Пишет он жёстко)
PHP:
public Action:Say(i_client, String:s_command[], i_args)
{
	if(i_client && IsClientInGame(i_client))
	{
		decl String:buffer[182];
		GetCmdArg(1, buffer, 182);
		if(IsPlayerAlive(i_client)) PrintToChatAll("[ %s ] %s: %s", g_s_CurrentRank[i_client], i_client, buffer);
		else if(GetClientTeam(i_client) == 1)
		{
			for(new i = 1; i <= MaxClients; i++)
			{
				if(GetClientTeam(i) == 1) PrintToChat(i, "*Spectator* [ %s ] %N: %s", g_s_CurrentRank[i_client], i_client, buffer);
			}
		}
		else
		{
			for(new x = 1; x <= MaxClients; x++ )
			{
				if(IsPlayerAlive(x)) PrintToChat(x, "[ %s ] %N: %s", g_s_CurrentRank[i_client], i_client, buffer);
				else PrintToChat(x, "*Death* [ %s ] %N: %s", g_s_CurrentRank[i_client], i_client, buffer);
			}
		}
		return Plugin_Handled; 
    }
    return Plugin_Continue; 
}
Оффтоп
 
  • Мне нравится
Реакции: TWRP
Сверху Снизу