#define _DMGP 1
#define _DMGS 1
#define _HPLEFT 1
#define _UpdRadarBlock 1
#define _RateCheck 0
#define _GameDesc "Sky-Play CSS:DM"
#define _HostagesGod 0
#if defined _GameDesc
#include <sdkhooks>
#endif
#if _DMGS
#include <sdktools_sound>
#include <sdktools_stringtables>
#endif
#if _HostagesGod
#include <sdktools_functions>
#endif
#if defined _GameDesc
public Action:OnGetGameDescription(String:gameDesc[64])
{
strcopy(gameDesc, sizeof(gameDesc), _GameDesc);
return Plugin_Changed;
}
#endif
#if _DMGS || _DMGP
public EventOnPlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if(attacker > 0 && (GetClientOfUserId(GetEventInt(event, "userid")) != attacker))
{
#if _DMGS
EmitSoundToClient(attacker, SOUNDPATH,SOUND_FROM_PLAYER,SNDCHAN_AUTO,SNDLEVEL_NORMAL,SND_NOFLAGS,VOLUME);
#endif
#if _DMGP
PrintCenterText(attacker, "-%d HP", GetEventInt(event, "dmg_health"));
#endif
}
}
#endif
#define _DEBUG 0
#if _DEBUG
LogDebug(false, "BuildLogFilePath - AFK Log File: %s", AFKM_LogFile);
#endif
Тоесть это не условия плагина, а условия для компиляции ?
И вот если объявлено
#define _DEBUG
это автоматически присваивает ему 1 ?
Если #define _DEBUG не будет, а #if _DEBUG - то приймет как 0 ?
Pawn Language Guide написал(а):#if constant expression, #elseif, #else, #endif
Portions of a program may be parsed or be ignored depending on certain conditions. The pawn parser (compiler or interpreter) generates code only for those portions for which the condition is true.
The directive #if must be followed by a constant expression. To check whether a variable or constant is defined, use the defined operator.
Zero or more #elseif directives may follow the initial #if directive. These blocks are skipped if any of the preceding #if or #elseif blocks were parsed (i.e. not skipped). As with the #if directive, a constant expression must follow the #elseif expression. The #else causes the parser to skip all lines up to #endif if the preceding #if or any of the preceding #elseif directives were “true”, and the parses these lines if all preceding blocks were skipped. The #else directive may be omitted; if present, there may be only be one #else associated with each #if.
The #endif directive terminates a program portion that is parsed conditionally. Conditional directives can be nested and each #if directive must be ended by an #endif directive.
P.S. Не дашь ссылочку ? :)
Грамотно будет так:#include - подключение дополнительного файла инклуде.
#include
Подключаемая библиотека SourceMod API или другой исходный файл - файл включения. Заключается в двойные кавычки или в <>.
#include <sourcemod>
Включение списков файлов всех структур, функций, вызовов и тегов, которые имеются в наличии.
http://www.c-cpp.ru/books/includeДиректива #include предлагает компилятору включить другой исходный файл, имя которого указывается после директивы. Имя файла заключается в двойные кавычки или в <>. Например, следующие две директивы указывают компилятору на необходимость подключить заголовочный файл стандартной библиотеки ввода/вывода:
#include "stdio.h"
#include <stdio.h>
Нет. Если взглянуть на страницу доков, то даже в ней указано, что это API для всех SM. К тому же, они действительно вызываются отдельно из того же SM (например, #include <cstrike>). Разве скобки убрать, (или файлы включения).ты написал для #include <sourcemod>
Прекращай таскать всё из C++, у нас тут всё-таки Pawn. Найдёшь из доков SM и Павна - милости прошу)Директива
Потому и нет некоторых слов, которые часто упоминаются.c++ только упрощенный
Библиотеки, отлично. Даже _wS_ так говорит.стандартной библиотеки
В доках самого SM такие слова не применяются. Вот и я лучше не буду...можно применять некоторые термины из других ЯП