Przepraszam, że 2 posty, ale nie mogę dodać. Mógłby ktoś podać przyczynę oraz zmienić to co trzeba. Z góry dziękuję.
SP:
/*<DR.API SMOKEGRENADE COLORS>(c) by <De Battista Clint -(http://doyou.watch)*/
/* */
/* <DR.API SMOKEGRENADE COLORS> is licensed under a */
/* Creative Commons Attribution-NonCommercial-NoDerivs 4.0 Unported License. */
/* */
/* You should have received a copy of the license along with this */
/* work. If not, see <http://creativecommons.org/licenses/by-nc-nd/4.0/>. */
//***************************************************************************//
//***************************************************************************//
//*************************DR.API SMOKEGRENADE COLORS************************//
//***************************************************************************//
//***************************************************************************//
#pragma semicolon 1
//***********************************//
//*************DEFINE****************//
//***********************************//
#define PLUGIN_VERSION "1.1.1"
#define CVARS FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY
#define DEFAULT_FLAGS FCVAR_PLUGIN|FCVAR_NOTIFY
#define TAG_CHAT "[SMOKEGRENADE COLORS] -"
#define MAX_SMOKE_COLORS 25
#define MAX_SMOKE_COLORS_STEAMID 25
//***********************************//
//*************INCLUDE***************//
//***********************************//
#undef REQUIRE_PLUGIN
#include <sourcemod>
#include <sdktools>
#include <clientprefs>
#include <autoexec>
#pragma newdecls required
//***********************************//
//***********PARAMETERS**************//
//***********************************//
//Handle
Handle cvar_active_smokegrenade_colors_dev;
Handle cvar_smokegrenade_colors_reset_timer;
Handle cvar_smokegrenade_colors_min_alpha;
Handle cvar_smokegrenade_colors_max_alpha;
Handle cvar_smokegrenade_colors_mod;
Handle H_TimerScreenEffect[2048];
Handle CookieSmokeColors;
//Bool
bool B_active_smokegrenade_colors_dev = false;
bool B_SmokeColors_SteamID[MAXPLAYERS+1][MAX_SMOKE_COLORS];
//Floats
float F_smokegrenade_colors_reset_timer;
float F_TimerResetCount;
//Strings
char S_smokecolorsparticlefile[MAX_SMOKE_COLORS][PLATFORM_MAX_PATH];
char S_smokecolorsparticlename[MAX_SMOKE_COLORS][PLATFORM_MAX_PATH];
char S_smokecolorsparticlecolor[MAX_SMOKE_COLORS][PLATFORM_MAX_PATH];
char S_smokecolorsflag[MAX_SMOKE_COLORS][64];
char S_smokecolorssteamid[MAX_SMOKE_COLORS][MAX_SMOKE_COLORS_STEAMID][64];
//Customs
int C_smokegrenade_colors_min_alpha;
int C_smokegrenade_colors_max_alpha;
int C_smokegrenade_colors_mod;
int C_color_smoke[MAXPLAYERS + 1];
int C_CountDown[2048];
int smoke_count;
int max_smoke_colors;
int max_smoke_colors_steamid[MAX_SMOKE_COLORS];
//Informations plugin
public Plugin myinfo =
{
name = "DR.API SMOKEGRENADE COLORS",
author = "Dr. Api",
description = "DR.API SMOKEGRENADE COLORS by Dr. Api",
version = PLUGIN_VERSION,
url = "http://zombie4ever.eu"
}
/***********************************************************/
/*********************** PLUGIN START **********************/
/***********************************************************/
public void OnPluginStart()
{
LoadTranslations("drapi/drapi_smokegrenade_colors.phrases");
AutoExecConfig_SetFile("drapi_smokegrenade_colors", "sourcemod/drapi");
AutoExecConfig_CreateConVar("drapi_smokegrenade_colors_version", PLUGIN_VERSION, "Version", CVARS);
cvar_active_smokegrenade_colors_dev = AutoExecConfig_CreateConVar("drapi_active_smokegrenade_colors_dev", "0", "Enable/Disable Dev Mod", DEFAULT_FLAGS, true, 0.0, true, 1.0);
cvar_smokegrenade_colors_reset_timer = AutoExecConfig_CreateConVar("drapi_smokegrenade_colors_reset_timer", "60.0", "Reset the smoke count timer(performence)", DEFAULT_FLAGS);
cvar_smokegrenade_colors_min_alpha = AutoExecConfig_CreateConVar("drapi_smokegrenade_colors_min_alpha", "180.0", "Min. Alpha overlay (transparency)", DEFAULT_FLAGS);
cvar_smokegrenade_colors_max_alpha = AutoExecConfig_CreateConVar("drapi_smokegrenade_colors_max_alpha", "255.0", "Max. Alpha overlay (transparency)", DEFAULT_FLAGS);
cvar_smokegrenade_colors_mod = AutoExecConfig_CreateConVar("drapi_smokegrenade_colors_mod", "0", "0=Access Flag / 1=Random Colors", DEFAULT_FLAGS);
HookEvent("smokegrenade_detonate", Event_SmokeDetonate, EventHookMode_Pre);
HookEvents();
HookEvent("round_start", Event_RoundStart);
AutoExecConfig_ExecuteFile();
AddTempEntHook("EffectDispatch", TE_EffectDispatch);
RegAdminCmd("sm_smoke", Command_Smoke, ADMFLAG_CHANGEMAP, "");
RegConsoleCmd("sm_sc", Command_BuildMenuSmokeColors);
CookieSmokeColors = RegClientCookie("CookieSmokeColors", "", CookieAccess_Private);
int info;
SetCookieMenuItem(SmokeColorsCookieHandler, info, "Smoke Colors");
int i = 1;
while (i <= MaxClients)
{
if (IsClientInGame(i))
{
if(IsClientInGame(i))
{
if(AreClientCookiesCached(i))
{
OnClientCookiesCached(i);
}
}
}
i++;
}
}
/***********************************************************/
/******************** WHEN CVAR CHANGED ********************/
/***********************************************************/
void HookEvents()
{
HookConVarChange(cvar_active_smokegrenade_colors_dev, Event_CvarChange);
HookConVarChange(cvar_smokegrenade_colors_reset_timer, Event_CvarChange);
HookConVarChange(cvar_smokegrenade_colors_min_alpha, Event_CvarChange);
HookConVarChange(cvar_smokegrenade_colors_max_alpha, Event_CvarChange);
HookConVarChange(cvar_smokegrenade_colors_mod, Event_CvarChange);
}
/***********************************************************/
/******************** WHEN CVARS CHANGE ********************/
/***********************************************************/
public void Event_CvarChange(Handle cvar, const char[] oldValue, const char[] newValue)
{
UpdateState();
}
/***********************************************************/
/*********************** UPDATE STATE **********************/
/***********************************************************/
void UpdateState()
{
B_active_smokegrenade_colors_dev = GetConVarBool(cvar_active_smokegrenade_colors_dev);
F_smokegrenade_colors_reset_timer = GetConVarFloat(cvar_smokegrenade_colors_reset_timer);
C_smokegrenade_colors_min_alpha = GetConVarInt(cvar_smokegrenade_colors_min_alpha);
C_smokegrenade_colors_max_alpha = GetConVarInt(cvar_smokegrenade_colors_max_alpha);
C_smokegrenade_colors_mod = GetConVarInt(cvar_smokegrenade_colors_mod);
}
/***********************************************************/
/********************* WHEN MAP START **********************/
/***********************************************************/
public void OnMapStart()
{
smoke_count = 0;
UpdateState();
}
/***********************************************************/
/******************* WHEN CONFIG EXECUTED ******************/
/***********************************************************/
public void OnConfigsExecuted()
{
LoadSettings();
}
/***********************************************************/
/**************** ON CLIENT COOKIE CACHED ******************/
/***********************************************************/
public void OnClientCookiesCached(int client)
{
char value[16];
GetClientCookie(client, CookieSmokeColors, value, sizeof(value));
if(strlen(value) > 0)
{
C_color_smoke[client] = StringToInt(value);
}
else
{
C_color_smoke[client] = 1;
}
}
/***********************************************************/
/********************** XMD SMOKE COLOR ********************/
/***********************************************************/
public Action Command_Smoke(int client, int args)
{
float origin[3];
GetClientAbsOrigin(client, origin);
char S_args1[256];
GetCmdArg(1, S_args1, sizeof(S_args1));
C_color_smoke[client] = StringToInt(S_args1);
//CreateParticle(client, S_smoke_colors[StringToInt(S_args1)], origin, NULL_VECTOR, 20.0);
}
/***********************************************************/
/********************** MENU SETTINGS **********************/
/***********************************************************/
public void SmokeColorsCookieHandler(int client, CookieMenuAction action, any info, char [] buffer, int maxlen)
{
BuildMenuSmokeColors(client);
}
/***********************************************************/
/******************** MENU SMOKE COLORS ********************/
/***********************************************************/
public Action Command_BuildMenuSmokeColors(int client, int args)
{
BuildMenuSmokeColors(client);
}
/***********************************************************/
/**************** BUILD MENU SMOKE COLORS ******************/
/***********************************************************/
void BuildMenuSmokeColors(int client)
{
char title[40];
char S_steamid[64];
Menu menu = CreateMenu(MenuSmokeColorsAction);
GetClientAuthId(client, AuthId_Steam2, S_steamid, sizeof(S_steamid));
for(int colors = 1; colors <= max_smoke_colors - 1; ++colors)
{
for(int steamid = 1; steamid <= max_smoke_colors_steamid[colors]; ++steamid)
{
if(StrEqual(S_smokecolorssteamid[colors][steamid], S_steamid ,false))
{
B_SmokeColors_SteamID[client][colors] = true;
}
}
if( (B_SmokeColors_SteamID[client][colors] == true && StrEqual(S_smokecolorsflag[colors], "steamid", false)) //Steamid only
|| (IsAdminEx(client) && StrEqual(S_smokecolorsflag[colors], "admin", false) || B_SmokeColors_SteamID[client][colors] == true) //Admin + steamid
|| ( (IsVip(client)|| IsAdminEx(client)) && StrEqual(S_smokecolorsflag[colors], "vip", false) || B_SmokeColors_SteamID[client][colors] == true) //Vip + steamid
|| StrEqual(S_smokecolorsflag[colors], "public", false) ) //Public
{
char S_colors[3];
IntToString(colors, S_colors, sizeof(S_colors));
char menu_color[40];
Format(menu_color, sizeof(menu_color), "%T", S_smokecolorsparticlename[colors], client);
AddMenuItem(menu, S_colors, menu_color);
}
}
Format(title, sizeof(title), "%T", "MenuSmokeColors_TITLE", client);
menu.SetTitle(title);
SetMenuExitBackButton(menu, true);
menu.Display(client, MENU_TIME_FOREVER);
}
/***********************************************************/
/*************** MENU ACTION SMOKE COLORS ******************/
/***********************************************************/
public int MenuSmokeColorsAction(Menu menu, MenuAction action, int param1, int param2)
{
switch(action)
{
case MenuAction_End:
{
CloseHandle(menu);
}
case MenuAction_Cancel:
{
if (param2 == MenuCancel_ExitBack)
{
FakeClientCommand(param1, "sm_settings");
}
}
case MenuAction_Select:
{
char menu1[56];
menu.GetItem(param2, menu1, sizeof(menu1));
int color = StringToInt(menu1);
C_color_smoke[param1] = color;
SetClientCookie(param1, CookieSmokeColors, menu1);
BuildMenuSmokeColors(param1);
}
}
}
/***********************************************************/
/******************** WHEN ROUND START *********************/
/***********************************************************/
public void Event_RoundStart(Handle event, char[] name, bool dontBroadcast)
{
for(int i = 0; i < smoke_count; i++)
{
if(H_TimerScreenEffect[i] != INVALID_HANDLE)
{
ClearTimer(H_TimerScreenEffect[i]);
}
}
smoke_count = 0;
}
/***********************************************************/
/****************** WHEN SMOKE DETONATE ********************/
/***********************************************************/
public void Event_SmokeDetonate(Handle event, char[] name, bool dontBroadcast)
{
//Good luck to reach this.
if(smoke_count > 2048) return;
int client = GetClientOfUserId(GetEventInt(event, "userid"));
float smoke_origin[3], projectile_origin[3];
smoke_origin[0] = GetEventFloat(event, "x");
smoke_origin[1] = GetEventFloat(event, "y");
smoke_origin[2] = GetEventFloat(event, "z");
int num = GetTheColor(client);
int index;
while((index = FindEntityByClassname(index, "smokegrenade_projectile")) != -1)
{
GetEntPropVector(index, Prop_Send, "m_vecOrigin", projectile_origin);
if(projectile_origin[0] == smoke_origin[0] && projectile_origin[1] == smoke_origin[1] && projectile_origin[2] == smoke_origin[2])
{
CreateParticle(index, S_smokecolorsparticlename[num], projectile_origin, NULL_VECTOR, 20.0);
if(num > 1)
{
C_CountDown[smoke_count] = 0;
Handle dataPackHandle;
H_TimerScreenEffect[smoke_count] = CreateDataTimer(0.0, TimerData_ScreenEffect, dataPackHandle, TIMER_REPEAT);
WritePackCell(dataPackHandle, smoke_count);
WritePackCell(dataPackHandle, num);
WritePackFloat(dataPackHandle, projectile_origin[0]);
WritePackFloat(dataPackHandle, projectile_origin[1]);
WritePackFloat(dataPackHandle, projectile_origin[2]);
//You have to kill the projectile otherwise you will see the gray overlay.
AcceptEntityInput(index, "Kill");
}
//Let's reset the count for fast process.
float now = GetEngineTime();
if(now >= F_TimerResetCount)
{
F_TimerResetCount = now + F_smokegrenade_colors_reset_timer;
smoke_count = 0;
}
smoke_count++;
}
}
}
/***********************************************************/
/************ TIMER DATA ON POST WEAPON EQUIP **************/
/***********************************************************/
public Action TimerData_ScreenEffect(Handle timer, Handle dataPackHandle)
{
ResetPack(dataPackHandle);
int index = ReadPackCell(dataPackHandle);
int num = ReadPackCell(dataPackHandle);
float pos[3];
pos[0] = ReadPackFloat(dataPackHandle);
pos[1] = ReadPackFloat(dataPackHandle);
pos[2] = ReadPackFloat(dataPackHandle);
char explode[3][10];
ExplodeString(S_smokecolorsparticlecolor[num], ", ", explode, 3, 10, true);
for(int i = 1; i <= MaxClients; ++i)
{
if(IsClientInGame(i) && IsPlayerAlive(i))
{
float cpos[3];
GetClientEyePosition(i, cpos);
float distance = GetVectorDistance(cpos, pos);
//Thx to Miumiu (not the pokemon) for the map part.
float alpha;
if(distance > 0 && distance <= 150)
{
alpha = C_smokegrenade_colors_max_alpha - (distance - 65) / (150 - 65) * (C_smokegrenade_colors_max_alpha - C_smokegrenade_colors_min_alpha);
}
else if(distance >= 150 && distance <= 160)
{
alpha = C_smokegrenade_colors_max_alpha - (distance - 150) / (160 - 150) * (C_smokegrenade_colors_min_alpha - 0);
}
else
{
alpha = 0.0;
}
if(alpha < 0) alpha = 0.0;
if(alpha > C_smokegrenade_colors_max_alpha) alpha = float(C_smokegrenade_colors_max_alpha);
if(distance < 160)
{
ScreenEffect(i, 10, 100, 0, StringToInt(explode[0]), StringToInt(explode[1]), StringToInt(explode[2]), RoundFloat(alpha));
}
if(B_active_smokegrenade_colors_dev)
{
//PrintToChat(i, "[%i] - %i - %f, %f %s", index, C_CountDown[index], distance, alpha, S_smoke_colors_int[num]);
}
}
}
if(C_CountDown[index] >= 170)
{
ClearTimer(H_TimerScreenEffect[index]);
}
C_CountDown[index]++;
}
/***********************************************************/
/******************* GET THE COLOR MOD *********************/
/***********************************************************/
int GetTheColor(int client)
{
int color;
if(C_smokegrenade_colors_mod == 1)
{
color = GetRandomInt(1, max_smoke_colors - 1);
}
else if(C_smokegrenade_colors_mod == 0)
{
color = C_color_smoke[client];
CheckAccessSmokeColors(client, color);
}
if(color <= 0) color = 1;
return color;
}
/***********************************************************/
/*************** CHECK ACCESS SMOKE COLORS******************/
/***********************************************************/
void CheckAccessSmokeColors(int client, int colors)
{
char S_steamid[64];
GetClientAuthId(client, AuthId_Steam2, S_steamid, sizeof(S_steamid));
for(int steamid = 1; steamid <= max_smoke_colors_steamid[colors]; ++steamid)
{
if(StrEqual(S_smokecolorssteamid[colors][steamid], S_steamid ,false))
{
B_SmokeColors_SteamID[client][colors] = true;
}
}
if( (B_SmokeColors_SteamID[client][colors] == true && StrEqual(S_smokecolorsflag[colors], "steamid", false)) //Steamid only
|| (IsAdminEx(client) && StrEqual(S_smokecolorsflag[colors], "admin", false) || B_SmokeColors_SteamID[client][colors] == true) //Admin + steamid
|| ( (IsVip(client)|| IsAdminEx(client)) && StrEqual(S_smokecolorsflag[colors], "vip", false) || B_SmokeColors_SteamID[client][colors] == true) //Vip + steamid
|| StrEqual(S_smokecolorsflag[colors], "public", false) ) //Public
{
return;
}
else
{
C_color_smoke[client] = 1;
SetClientCookie(client, CookieSmokeColors, "1");
}
}
/***********************************************************/
/******************** EFFECT DISPATCH **********************/
/***********************************************************/
public Action TE_EffectDispatch(const char[] te_name, const int[] Players, int numClients, float delay)
{
int iEffectIndex = TE_ReadNum("m_iEffectName");
char sEffectName[64];
GetEffectName(iEffectIndex, sEffectName, sizeof(sEffectName));
int nHitBox = TE_ReadNum("m_nHitBox");
if(StrEqual(sEffectName, "ParticleEffect"))
{
char sParticleEffectName[64];
GetParticleEffectName(nHitBox, sParticleEffectName, sizeof(sParticleEffectName));
if(StrEqual(sParticleEffectName, "explosion_smokegrenade", false))
{
return Plugin_Handled;
}
}
return Plugin_Continue;
}
/***********************************************************/
/********************* SCREEN EFFECT ***********************/
/***********************************************************/
stock void ScreenEffect(int client, int duration, int hold_time, int flag, int red, int green, int blue, int alpha)
{
Handle hFade = INVALID_HANDLE;
if(client)
{
hFade = StartMessageOne("Fade", client);
}
else
{
hFade = StartMessageAll("Fade");
}
if(hFade != INVALID_HANDLE)
{
if(GetUserMessageType() == UM_Protobuf)
{
int clr[4];
clr[0]=red;
clr[1]=green;
clr[2]=blue;
clr[3]=alpha;
PbSetInt(hFade, "duration", duration);
PbSetInt(hFade, "hold_time", hold_time);
PbSetInt(hFade, "flags", flag);
PbSetColor(hFade, "clr", clr);
}
else
{
BfWriteShort(hFade, duration);
BfWriteShort(hFade, hold_time);
BfWriteShort(hFade, flag);
BfWriteByte(hFade, red);
BfWriteByte(hFade, green);
BfWriteByte(hFade, blue);
BfWriteByte(hFade, alpha);
}
EndMessage();
}
}
/***********************************************************/
/******************** CREATE PARTICLE **********************/
/***********************************************************/
void CreateParticle(int ent, char[] particleType, float Pos[3], float Ang[3], float time=10.0)
{
int particle = CreateEntityByName("info_particle_system");
PrecacheParticleEffect(particleType);
if(IsValidEdict(particle))
{
PrecacheParticleEffect(particleType);
char tName[128];
Format(tName, sizeof(tName), "target%i", ent);
DispatchKeyValue(ent, "targetname", tName);
TeleportEntity(particle, Pos, Ang, NULL_VECTOR);
DispatchKeyValue(particle, "effect_name", particleType);
DispatchSpawn(particle);
ActivateEntity(particle);
AcceptEntityInput(particle, "start");
CreateTimer(time, Timer_DeleteParticle, particle);
}
}
/***********************************************************/
/***************** TIMER REMOVE PARTICLE *******************/
/***********************************************************/
public Action Timer_DeleteParticle(Handle timer, any particle)
{
if(IsValidEntity(particle))
{
char classname[128];
GetEdictClassname(particle, classname, sizeof(classname));
if (StrEqual(classname, "info_particle_system", false))
{
RemoveEdict(particle);
}
}
}
/***********************************************************/
/********************** LOAD SETTINGS **********************/
/***********************************************************/
public void LoadSettings()
{
char hc[PLATFORM_MAX_PATH];
BuildPath(Path_SM, hc, sizeof(hc), "configs/drapi/smokegrenade_colors.cfg");
Handle kv = CreateKeyValues("SmokeColors");
FileToKeyValues(kv, hc);
max_smoke_colors = 1;
int max_color = 1;
if(KvGotoFirstSubKey(kv))
{
do
{
if(KvJumpToKey(kv, "SmokeColors"))
{
char S_info[MAX_SMOKE_COLORS][PLATFORM_MAX_PATH];
for(int i = 1; i <= MAX_SMOKE_COLORS; ++i)
{
char key[64];
IntToString(i, key, 64);
if(KvGetString(kv, key, S_info[i], PLATFORM_MAX_PATH) && strlen(S_info[i]))
{
char explode[3][PLATFORM_MAX_PATH];
ExplodeString(S_info[i], " | ", explode, 3, PLATFORM_MAX_PATH, true);
S_smokecolorsparticlefile[i] = explode[0];
S_smokecolorsparticlename[i] = explode[1];
S_smokecolorsparticlecolor[i] = explode[2];
if(i > 1)
{
char S_path[PLATFORM_MAX_PATH];
Format(S_path, PLATFORM_MAX_PATH, "particles/%s.pcf", S_smokecolorsparticlefile[i]);
AddFileToDownloadsTable(S_path);
PrecacheGeneric(S_path, true);
PrecacheParticleEffect(S_smokecolorsparticlename[i]);
if(B_active_smokegrenade_colors_dev)
{
LogMessage("%s File: %s", TAG_CHAT, S_smokecolorsparticlefile[i]);
LogMessage("%s Particle: %s", TAG_CHAT, S_smokecolorsparticlename[i]);
LogMessage("%s Color: %s", TAG_CHAT, S_smokecolorsparticlecolor[i]);
LogMessage("%s", S_path);
}
}
max_smoke_colors++;
}
else
{
break;
}
}
KvGoBack(kv);
}
if(KvJumpToKey(kv, "SmokeColorsAccess"))
{
if(KvGotoFirstSubKey(kv))
{
do
{
char S_info[3];
if(KvGetSectionName(kv, S_info, 3))
{
KvGetString(kv, "flags", S_smokecolorsflag[max_color], 64);
max_smoke_colors_steamid[max_color] = 1;
if(KvJumpToKey(kv, "SteamIDs"))
{
for(int i = 1; i <= MAX_SMOKE_COLORS_STEAMID; ++i)
{
char key[3];
IntToString(i, key, 3);
if(KvGetString(kv, key, S_smokecolorssteamid[max_color][i], 64) && strlen(S_smokecolorssteamid[max_color][i]))
{
if(B_active_smokegrenade_colors_dev)
{
LogMessage("%s [%i] - ID: %i, STEAMID: %s", TAG_CHAT, max_color, i, S_smokecolorssteamid[max_color][i]);
}
max_smoke_colors_steamid[max_color] = i;
}
else
{
break;
}
}
KvGoBack(kv);
}
if(B_active_smokegrenade_colors_dev)
{
LogMessage("%s, %s", S_info, S_smokecolorsflag[max_color]);
}
max_color++;
}
}
while (KvGotoNextKey(kv));
}
}
}
while (KvGotoNextKey(kv));
}
CloseHandle(kv);
}
/***********************************************************/
/*************** PRECACHE PARTICLE EFFECT ******************/
/***********************************************************/
stock void PrecacheParticleEffect(const char[] sEffectName)
{
static int table = INVALID_STRING_TABLE;
if(table == INVALID_STRING_TABLE)
{
table = FindStringTable("ParticleEffectNames");
}
bool save = LockStringTables(false);
AddToStringTable(table, sEffectName);
LockStringTables(save);
}
/***********************************************************/
/******************** GET EFFECT NAME **********************/
/***********************************************************/
stock void GetEffectName(int index, char[] sEffectName, int maxlen)
{
static int table = INVALID_STRING_TABLE;
if(table == INVALID_STRING_TABLE)
{
table = FindStringTable("EffectDispatch");
}
ReadStringTable(table, index, sEffectName, maxlen);
}
/***********************************************************/
/*************** GET PARTICLE EFFECT NAME ******************/
/***********************************************************/
stock void GetParticleEffectName(int index, char[] sEffectName, int maxlen)
{
static int table = INVALID_STRING_TABLE;
if(table == INVALID_STRING_TABLE)
{
table = FindStringTable("ParticleEffectNames");
}
ReadStringTable(table, index, sEffectName, maxlen);
}
/***********************************************************/
/*************** GET PARTICLE EFFECT INDEX *****************/
/***********************************************************/
stock int GetParticleEffectIndex(const char[] sEffectName)
{
static int table = INVALID_STRING_TABLE;
if(table == INVALID_STRING_TABLE)
{
table = FindStringTable("ParticleEffectNames");
}
int iIndex = FindStringIndex(table, sEffectName);
if(iIndex != INVALID_STRING_INDEX)
return iIndex;
// This is the invalid string index
return 0;
}
/***********************************************************/
/********************** CLEAR TIMER ************************/
/***********************************************************/
stock void ClearTimer(Handle &timer)
{
if (timer != INVALID_HANDLE)
{
KillTimer(timer);
timer = INVALID_HANDLE;
}
}
/***********************************************************/
/******************** CHECK IF IS A VIP ********************/
/***********************************************************/
stock bool IsVip(int client)
{
if(GetUserFlagBits(client) & ADMFLAG_CUSTOM1
|| GetUserFlagBits(client) & ADMFLAG_CUSTOM2
|| GetUserFlagBits(client) & ADMFLAG_CUSTOM3
|| GetUserFlagBits(client) & ADMFLAG_CUSTOM4
|| GetUserFlagBits(client) & ADMFLAG_CUSTOM5
|| GetUserFlagBits(client) & ADMFLAG_CUSTOM6)
{
return true;
}
return false;
}
/***********************************************************/
/****************** CHECK IF IS AN ADMIN *******************/
/***********************************************************/
stock bool IsAdminEx(int client)
{
if(
/*|| GetUserFlagBits(client) & ADMFLAG_RESERVATION*/
GetUserFlagBits(client) & ADMFLAG_GENERIC
|| GetUserFlagBits(client) & ADMFLAG_KICK
|| GetUserFlagBits(client) & ADMFLAG_BAN
|| GetUserFlagBits(client) & ADMFLAG_UNBAN
|| GetUserFlagBits(client) & ADMFLAG_SLAY
|| GetUserFlagBits(client) & ADMFLAG_CHANGEMAP
|| GetUserFlagBits(client) & ADMFLAG_CONVARS
|| GetUserFlagBits(client) & ADMFLAG_CONFIG
|| GetUserFlagBits(client) & ADMFLAG_CHAT
|| GetUserFlagBits(client) & ADMFLAG_VOTE
|| GetUserFlagBits(client) & ADMFLAG_PASSWORD
|| GetUserFlagBits(client) & ADMFLAG_RCON
|| GetUserFlagBits(client) & ADMFLAG_CHEATS
|| GetUserFlagBits(client) & ADMFLAG_ROOT)
{
return true;
}
return false;
}