Madness aka null138
Участник
- Сообщения
- 713
- Реакции
- 734
Как получить количество спавнов и к какой команде они пренадлежат? Spawn Tools 7 пишет 0.
vprof 1
+showvprof
Как получить количество спавнов и к какой команде они пренадлежат? Spawn Tools 7 пишет 0.
Мне именно нужно через плагин, метод сLoco, если средствами SM, то можно несложный плагин набросать.
А вообще можно через редакторы карт глянуть.
FindEntityByClassname (-1, "info_player_terrorist")
не работает, их обще не видет в списке енотов (65-2048). Есть ли иной способ найти через sm?Мне именно нужно через плагин, метод сFindEntityByClassname (-1, "info_player_terrorist")
не работает, их обще не видет в списке енотов (65-2048). Есть ли иной способ найти через sm?
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <clientprefs>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo =
{
name = "Teammate Glow",
author = "Emptyc",
version = "1.2",
url = ""
};
int g_iEntity[MAXPLAYERS+1],
g_iClientColor[2][4];
char //g_sModelPath[256],
g_sAnimation[64];
bool g_bIsEnabled[MAXPLAYERS+1];
Handle g_hCookies;
public void OnPluginStart()
{
g_hCookies = RegClientCookie("team_glow_cookies", "", CookieAccess_Private);
ConVar
//hCvar = CreateConVar("sm_tg_model", "models/coop/challenge_coin.mdl", "Путь до модели"); hCvar.AddChangeHook(OnModelChanged);
//hCvar.GetString(g_sModelPath, sizeof g_sModelPath);
hCvar = CreateConVar("sm_tg_model_animation", "idle", "Анимация модели"); hCvar.AddChangeHook(OnAnimationChanged);
hCvar.GetString(g_sAnimation, sizeof g_sAnimation);
char sColor[16];
hCvar = CreateConVar("sm_tg_ct_color", "0 238 255 255", "Цвет подсветки кт"); hCvar.AddChangeHook(OnCtColorChanged);
hCvar.GetString(sColor, sizeof sColor);
GetRGBAFromString(1, sColor);
hCvar = CreateConVar("sm_tg_t_color", "255 213 0 255", "Цвет подсветки т"); hCvar.AddChangeHook(OnTColorChanged);
hCvar.GetString(sColor, sizeof sColor);
GetRGBAFromString(0, sColor);
AutoExecConfig(true, "team_glow");
HookEvent("player_spawn", ePS);
HookEvent("player_death", ePD);
RegConsoleCmd("sm_teamglow", OnOffGlow);
for (int i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i) && !IsFakeClient(i) && !IsClientSourceTV(i))
{
OnClientCookiesCached(i);
}
}
}
public void OnPluginEnd()
{
for (int i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i) && !IsFakeClient(i) && !IsClientSourceTV(i))
{
RemoveModel(i);
OnClientDisconnect(i);
}
}
}
/*
public void OnModelChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue)
{
strcopy(g_sModelPath, sizeof g_sModelPath, sNewValue);
}*/
public void OnAnimationChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue)
{
strcopy(g_sAnimation, sizeof g_sAnimation, sNewValue);
}
public void OnCtColorChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue)
{
GetRGBAFromString(1, sNewValue);
}
public void OnTColorChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue)
{
GetRGBAFromString(0, sNewValue);
}
void GetRGBAFromString(int iTeam, char[] sBuffer)
{
char sBuffers[4][4];
ExplodeString(sBuffer, " ", sBuffers, sizeof(sBuffers), sizeof(sBuffers[]));
g_iClientColor[iTeam][0] = StringToInt(sBuffers[0]);
g_iClientColor[iTeam][1] = StringToInt(sBuffers[1]);
g_iClientColor[iTeam][2] = StringToInt(sBuffers[2]);
g_iClientColor[iTeam][3] = StringToInt(sBuffers[3]);
}
public void OnClientCookiesCached(int iClient)
{
char sBuff[8];
GetClientCookie(iClient, g_hCookies, sBuff, sizeof sBuff);
g_bIsEnabled[iClient] = !sBuff[0] ? true:!!StringToInt(sBuff);
}
public void OnClientDisconnect(int iClient)
{
RemoveModel(iClient);
char sBuff[8];
IntToString(g_bIsEnabled[iClient], sBuff, sizeof sBuff);
SetClientCookie(iClient, g_hCookies, sBuff);
}
public Action OnOffGlow(int iClient, int iArgs)
{
g_bIsEnabled[iClient] = !g_bIsEnabled[iClient];
PrintToChat(iClient, "[SM] Подсветка тимейтов [%s]", g_bIsEnabled[iClient] ? "Вкл":"Выкл");
return Plugin_Handled;
}
public void ePD(Event event, const char[] name, bool dontBroadcast)
{
RemoveModel(GetClientOfUserId(GetEventInt(event, "userid")));
}
public void ePS(Event event, const char[] name, bool silent)
{
SetGlow(GetClientOfUserId(GetEventInt(event, "userid")));
}
/*
public void OnMapStart()
{
PrecacheModel(g_sModelPath);
}*/
void SetGlow(int client)
{
if (!IsClientInGame(client) || !IsPlayerAlive(client))
{
return;
}
char buffer[128];
GetClientModel(client, buffer, sizeof(buffer));
int iEntity = CreatePlayerModel(client, buffer);
int iOffset = GetEntSendPropOffs(iEntity, "m_clrGlow");
if (iOffset == -1)
{
LogError("Bad offset: \"m_clrGlow\"!");
return;
}
int iTeam = GetClientTeam(client);
SetEntProp(iEntity, Prop_Send, "m_bShouldGlow", true, true);
SetEntProp(iEntity, Prop_Send, "m_nGlowStyle", 0); // 0 - esp / 1,2 - glow
SetEntPropFloat(iEntity, Prop_Send, "m_flGlowMaxDist", 10000000.0);
for (int i = 0; i < 4; i++)
{
SetEntData(iEntity, iOffset + i, g_iClientColor[iTeam-2][i], _, true);
}
}
int CreatePlayerModel(int client, char[] buffer)
{
RemoveModel(client);
int iEntity = CreateEntityByName("prop_dynamic_override");
DispatchKeyValue(iEntity, "model", buffer);
DispatchKeyValue(iEntity, "solid", "0");
DispatchSpawn(iEntity);
SetEntityRenderMode(iEntity, RENDER_TRANSALPHA);
SetEntityRenderColor(iEntity, 255, 255, 255, 0);
SetEntProp(iEntity, Prop_Send, "m_fEffects", (1 << 0)|(1 << 4)|(1 << 6)|(1 << 9));
SetVariantString("!activator");
AcceptEntityInput(iEntity, "SetParent", client, iEntity, 0);
SetVariantString("primary");
AcceptEntityInput(iEntity, "SetParentAttachment", iEntity, iEntity, 0);
SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", client);
g_iEntity[client] = EntIndexToEntRef(iEntity);
SDKHook(iEntity, SDKHook_SetTransmit, SetTransmit);
return iEntity;
}
void RemoveModel(int client)
{
int iEntity = EntRefToEntIndex(g_iEntity[client]);
if(IsEntityValid(iEntity)) AcceptEntityInput(iEntity, "Kill");
g_iEntity[client] = 0;
}
bool IsEntityValid(int iEntity)
{
if(iEntity != INVALID_ENT_REFERENCE && iEntity > 0 && IsValidEntity(iEntity)) return true;
return false;
}
public Action SetTransmit(int iEntity, int iClient)
{
int iOwner;
return ((iOwner = GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity")) != -1 && (iOwner == iClient || GetClientTeam(iOwner) != GetClientTeam(iClient))) || !g_bIsEnabled[iClient] ? Plugin_Handled:Plugin_Continue;
}
Подсветку же невозможно скрыть, не так ли?Всем привет, выручайте, исходит утечка памяти из плагина. Не подозреваю откуда именно.
PHP:#include <sourcemod> #include <sdktools> #include <sdkhooks> #include <clientprefs> #pragma semicolon 1 #pragma newdecls required public Plugin myinfo = { name = "Teammate Glow", author = "Emptyc", version = "1.2", url = "" }; int g_iEntity[MAXPLAYERS+1], g_iClientColor[2][4]; char //g_sModelPath[256], g_sAnimation[64]; bool g_bIsEnabled[MAXPLAYERS+1]; Handle g_hCookies; public void OnPluginStart() { g_hCookies = RegClientCookie("team_glow_cookies", "", CookieAccess_Private); ConVar //hCvar = CreateConVar("sm_tg_model", "models/coop/challenge_coin.mdl", "Путь до модели"); hCvar.AddChangeHook(OnModelChanged); //hCvar.GetString(g_sModelPath, sizeof g_sModelPath); hCvar = CreateConVar("sm_tg_model_animation", "idle", "Анимация модели"); hCvar.AddChangeHook(OnAnimationChanged); hCvar.GetString(g_sAnimation, sizeof g_sAnimation); char sColor[16]; hCvar = CreateConVar("sm_tg_ct_color", "0 238 255 255", "Цвет подсветки кт"); hCvar.AddChangeHook(OnCtColorChanged); hCvar.GetString(sColor, sizeof sColor); GetRGBAFromString(1, sColor); hCvar = CreateConVar("sm_tg_t_color", "255 213 0 255", "Цвет подсветки т"); hCvar.AddChangeHook(OnTColorChanged); hCvar.GetString(sColor, sizeof sColor); GetRGBAFromString(0, sColor); AutoExecConfig(true, "team_glow"); HookEvent("player_spawn", ePS); HookEvent("player_death", ePD); RegConsoleCmd("sm_teamglow", OnOffGlow); for (int i = 1; i <= MaxClients; ++i) { if (IsClientInGame(i) && !IsFakeClient(i) && !IsClientSourceTV(i)) { OnClientCookiesCached(i); } } } public void OnPluginEnd() { for (int i = 1; i <= MaxClients; ++i) { if (IsClientInGame(i) && !IsFakeClient(i) && !IsClientSourceTV(i)) { RemoveModel(i); OnClientDisconnect(i); } } } /* public void OnModelChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue) { strcopy(g_sModelPath, sizeof g_sModelPath, sNewValue); }*/ public void OnAnimationChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue) { strcopy(g_sAnimation, sizeof g_sAnimation, sNewValue); } public void OnCtColorChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue) { GetRGBAFromString(1, sNewValue); } public void OnTColorChanged(ConVar hCvar, char[] sOldValue, char[] sNewValue) { GetRGBAFromString(0, sNewValue); } void GetRGBAFromString(int iTeam, char[] sBuffer) { char sBuffers[4][4]; ExplodeString(sBuffer, " ", sBuffers, sizeof(sBuffers), sizeof(sBuffers[])); g_iClientColor[iTeam][0] = StringToInt(sBuffers[0]); g_iClientColor[iTeam][1] = StringToInt(sBuffers[1]); g_iClientColor[iTeam][2] = StringToInt(sBuffers[2]); g_iClientColor[iTeam][3] = StringToInt(sBuffers[3]); } public void OnClientCookiesCached(int iClient) { char sBuff[8]; GetClientCookie(iClient, g_hCookies, sBuff, sizeof sBuff); g_bIsEnabled[iClient] = !sBuff[0] ? true:!!StringToInt(sBuff); } public void OnClientDisconnect(int iClient) { RemoveModel(iClient); char sBuff[8]; IntToString(g_bIsEnabled[iClient], sBuff, sizeof sBuff); SetClientCookie(iClient, g_hCookies, sBuff); } public Action OnOffGlow(int iClient, int iArgs) { g_bIsEnabled[iClient] = !g_bIsEnabled[iClient]; PrintToChat(iClient, "[SM] Подсветка тимейтов [%s]", g_bIsEnabled[iClient] ? "Вкл":"Выкл"); return Plugin_Handled; } public void ePD(Event event, const char[] name, bool dontBroadcast) { RemoveModel(GetClientOfUserId(GetEventInt(event, "userid"))); } public void ePS(Event event, const char[] name, bool silent) { SetGlow(GetClientOfUserId(GetEventInt(event, "userid"))); } /* public void OnMapStart() { PrecacheModel(g_sModelPath); }*/ void SetGlow(int client) { if (!IsClientInGame(client) || !IsPlayerAlive(client)) { return; } char buffer[128]; GetClientModel(client, buffer, sizeof(buffer)); int iEntity = CreatePlayerModel(client, buffer); int iOffset = GetEntSendPropOffs(iEntity, "m_clrGlow"); if (iOffset == -1) { LogError("Bad offset: \"m_clrGlow\"!"); return; } int iTeam = GetClientTeam(client); SetEntProp(iEntity, Prop_Send, "m_bShouldGlow", true, true); SetEntProp(iEntity, Prop_Send, "m_nGlowStyle", 0); // 0 - esp / 1,2 - glow SetEntPropFloat(iEntity, Prop_Send, "m_flGlowMaxDist", 10000000.0); for (int i = 0; i < 4; i++) { SetEntData(iEntity, iOffset + i, g_iClientColor[iTeam-2][i], _, true); } } int CreatePlayerModel(int client, char[] buffer) { RemoveModel(client); int iEntity = CreateEntityByName("prop_dynamic_override"); DispatchKeyValue(iEntity, "model", buffer); DispatchKeyValue(iEntity, "solid", "0"); DispatchSpawn(iEntity); SetEntityRenderMode(iEntity, RENDER_TRANSALPHA); SetEntityRenderColor(iEntity, 255, 255, 255, 0); SetEntProp(iEntity, Prop_Send, "m_fEffects", (1 << 0)|(1 << 4)|(1 << 6)|(1 << 9)); SetVariantString("!activator"); AcceptEntityInput(iEntity, "SetParent", client, iEntity, 0); SetVariantString("primary"); AcceptEntityInput(iEntity, "SetParentAttachment", iEntity, iEntity, 0); SetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity", client); g_iEntity[client] = EntIndexToEntRef(iEntity); SDKHook(iEntity, SDKHook_SetTransmit, SetTransmit); return iEntity; } void RemoveModel(int client) { int iEntity = EntRefToEntIndex(g_iEntity[client]); if(IsEntityValid(iEntity)) AcceptEntityInput(iEntity, "Kill"); g_iEntity[client] = 0; } bool IsEntityValid(int iEntity) { if(iEntity != INVALID_ENT_REFERENCE && iEntity > 0 && IsValidEntity(iEntity)) return true; return false; } public Action SetTransmit(int iEntity, int iClient) { int iOwner; return ((iOwner = GetEntPropEnt(iEntity, Prop_Send, "m_hOwnerEntity")) != -1 && (iOwner == iClient || GetClientTeam(iOwner) != GetClientTeam(iClient))) || !g_bIsEnabled[iClient] ? Plugin_Handled:Plugin_Continue; }
Команда есть, чтобы включить и выключить. !teamglow в данном случаеПодсветку же невозможно скрыть, не так ли?
Если у тебя карта использует скрипты, можно оставить эту папку только на сервереВозможно ли написать плагин который будет докачивать текстуры на определённые карты? Нужно это для защиты карт от постороннего использования.
Использую на джайле JWP+Hosties
Нужен плагин, для выдачи оружия при спавне кт (один раз)
Подскажите, есть ли что-то похожие в мире csgo? (не смог найти)
Пример из cs 1.6:
Посмотреть вложение 50122
не совсем то![]()
GitHub - HardcorePark/CTGuns: CT Guns
CT Guns. Contribute to HardcorePark/CTGuns development by creating an account on GitHub.github.com
Напишите что не устраивает, может помогу. Только для CSGO!не совсем то
Я не имея никаких знаний просто открывал исходный код и смотрел как все работает. Просто появилась потребность что то делать для себя, первое что я сделал это вырезал одну функцию из deathrun manager от Elistor которая просто добавляет фраг при суициде, таким образом у вас не отнимаются фраги.Народ, хотел бы поинтересоваться в одном деле. Вот кто-то пишет плагины, кто-то понимает в чем ошибка плагина и может сам ее пофиксить не спрашиваю ни у кого, ну дак к чему я, как вы это все понимаете? Как вы учились или учили вас? Просто хотелось бы также обладать подобными навыками но не совсем понимаю как нужно начать, не могли бы вы подсказать?
Понимаю что тема создана не для этого но как по мне она больше подходит так-как её просматривает много людей и отвечаю тут быстро
В этом плагине есть огромное меню, где можно выбрать одно оружие.Напишите что не устраивает, может помогу. Только для CSGO!