Shid0
🦾 Свет даëт мне сил!
- Сообщения
- 1,130
- Реакции
- 1,255
#include <sdkhooks>
#include <sdktools>
public void OnPluginStart()
{
HookEvent("player_spawn", Event_Spawn);
AddCommandListener(Event_Drop, "drop");
}
public void Event_Spawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if(!client) return;
GivePlayerItem(client, "weapon_decoy");
}
public Action Event_Drop(int client, const char[] command, int args)
{
int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
if(IsValidEntity(weapon))
{
char cls[15];
GetEdictClassname(weapon, cls, sizeof(cls));
if(!strcmp(cls, "weapon_decoy"))
return Plugin_Handled;
}
return Plugin_Continue;
}
public void OnEntityCreated(int ent, const char[] cls)
{
if(!strcmp(cls, "decoy_projectile"))
SDKHook(ent, SDKHook_Spawn, OnDecoySpawned);
}
public void OnDecoySpawned(int ent)
{
int client = GetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity");
if(client > 0 && IsClientInGame(client) && IsPlayerAlive(client))
CreateTimer(20.0, Event_Timer, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}
public Action Event_Timer(Handle hTimer, any UserId)
{
int client = GetClientOfUserId(UserId);
if(!IsClientInGame(client) && !IsPlayerAlive(client))
return Plugin_Stop;
int weapon = GivePlayerItem(client, "weapon_decoy");
FakeClientCommandEx(client, "use weapon_decoy");
SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon);
return Plugin_Stop;
}
Спасибо! У меня игроки не могут сбрасывать оружия и при смерти с них ничего не падает)¯\_(ツ)_/¯
C-подобный:#include <sdkhooks> #include <sdktools> public void OnPluginStart() { HookEvent("player_spawn", Event_Spawn); AddCommandListener(Event_Drop, "drop"); } public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(event.GetInt("userid")); if(!client) return; GivePlayerItem(client, "weapon_decoy"); } public Action Event_Drop(int client, const char[] command, int args) { int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"); if(IsValidEntity(weapon)) { char cls[15]; GetEdictClassname(weapon, cls, sizeof(cls)); if(!strcmp(cls, "weapon_decoy")) return Plugin_Handled; } return Plugin_Continue; } public void OnEntityCreated(int ent, const char[] cls) { if(!strcmp(cls, "decoy_projectile")) SDKHook(ent, SDKHook_Spawn, OnDecoySpawned); } public void OnDecoySpawned(int ent) { int client = GetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity"); if(client > 0 && IsClientInGame(client) && IsPlayerAlive(client)) CreateTimer(20.0, Event_Timer, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); } public Action Event_Timer(Handle hTimer, any UserId) { int client = GetClientOfUserId(UserId); if(!IsClientInGame(client) && !IsPlayerAlive(client)) return Plugin_Stop; int weapon = GivePlayerItem(client, "weapon_decoy"); FakeClientCommandEx(client, "use weapon_decoy"); SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon); return Plugin_Stop; }
upd; вообще наверно бы желательно проверку на таймер повесить, мало ли игрок где-то уже подобрал декой в момент когда мы ему запустили таймер.
Не плагин, переменные:@I3asara, ну я этого не знал) подредактируй под свои нужды, в таком случае event_drop тебе не нужен вовсе если это уже делает сторонний плагин. Я предусмотрел и добавил его т.к ты изначально не уточнил что сбрасывать не могут
Хорошо, проверю вечером после работы.@I3asara, окей ну проверь по идеи должно работать, я не проверял
Требуется написать плагин, который будет выдавать decoy всем на карте при спавне.
"mp_ct_default_grenades" = "" game replicated
- The default grenades that the CTs will spawn with. To give multiple grenades
, s
"mp_t_default_grenades" = "" game replicated
- The default grenades that the Ts will spawn with. To give multiple grenades,
se
Если кинуть декой во время экрана победы и он не успеет восстановиться, то таймер по 1 месту пойдет и начнет выдавать все чаще и чаще.¯\_(ツ)_/¯
C-подобный:#include <sdkhooks> #include <sdktools> public void OnPluginStart() { HookEvent("player_spawn", Event_Spawn); AddCommandListener(Event_Drop, "drop"); } public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(event.GetInt("userid")); if(!client) return; GivePlayerItem(client, "weapon_decoy"); } public Action Event_Drop(int client, const char[] command, int args) { int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon"); if(IsValidEntity(weapon)) { char cls[15]; GetEdictClassname(weapon, cls, sizeof(cls)); if(!strcmp(cls, "weapon_decoy")) return Plugin_Handled; } return Plugin_Continue; } public void OnEntityCreated(int ent, const char[] cls) { if(!strcmp(cls, "decoy_projectile")) SDKHook(ent, SDKHook_Spawn, OnDecoySpawned); } public void OnDecoySpawned(int ent) { int client = GetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity"); if(client > 0 && IsClientInGame(client) && IsPlayerAlive(client)) CreateTimer(20.0, Event_Timer, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); } public Action Event_Timer(Handle hTimer, any UserId) { int client = GetClientOfUserId(UserId); if(!IsClientInGame(client) && !IsPlayerAlive(client)) return Plugin_Stop; int weapon = GivePlayerItem(client, "weapon_decoy"); FakeClientCommandEx(client, "use weapon_decoy"); SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon); return Plugin_Stop; }
upd; вообще наверно бы желательно проверку на таймер повесить, мало ли игрок где-то уже подобрал декой в момент когда мы ему запустили таймер.
#include <sdkhooks>
#include <sdktools>
Handle g_hTimer[MAXPLAYERS + 1];
public void OnPluginStart() {
HookEvent("player_spawn", Event_Spawn);
AddCommandListener(Event_Drop, "drop");
}
public void Event_Spawn(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if (!client)return;
if (g_hTimer[client]) {
KillTimer(g_hTimer[client]);
g_hTimer[client] = null;
}
GivePlayerItem(client, "weapon_decoy");
}
public Action Event_Drop(int client, const char[] command, int args) {
if (g_hTimer[client]) {
KillTimer(g_hTimer[client]);
}
int weapon = GetEntPropEnt(client, Prop_Data, "m_hActiveWeapon");
if (IsValidEntity(weapon)) {
char cls[15];
GetEdictClassname(weapon, cls, sizeof(cls));
if (!strcmp(cls, "weapon_decoy"))
return Plugin_Handled;
}
return Plugin_Continue;
}
public void OnEntityCreated(int ent, const char[] cls) {
if (!strcmp(cls, "decoy_projectile"))
SDKHook(ent, SDKHook_Spawn, OnDecoySpawned);
}
public void OnDecoySpawned(int ent) {
int client = GetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity");
g_hTimer[client] = null;
if (client > 0 && IsClientInGame(client) && IsPlayerAlive(client))
g_hTimer[client] = CreateTimer(20.0, Event_Timer, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}
public Action Event_Timer(Handle hTimer, any UserId) {
int client = GetClientOfUserId(UserId);
g_hTimer[client] = null;
if (!IsClientInGame(client) && !IsPlayerAlive(client))
return Plugin_Stop;
int weapon = GivePlayerItem(client, "weapon_decoy");
FakeClientCommandEx(client, "use weapon_decoy");
SetEntPropEnt(client, Prop_Send, "m_hActiveWeapon", weapon);
return Plugin_Stop;
}
public void OnClientDisconnect(int client) {
if (g_hTimer[client]) {
KillTimer(g_hTimer[client]);
g_hTimer[client] = null;
}
}
Хотел бы поинтересоваться зачем нужен такой плагин)Требуется написать плагин, который будет выдавать decoy всем на карте при спавне.
Если игрок выбросил decoy, то выдать ему новый через 20 сек.
И так выдавать пока он не умрет.
Связь в Дискорд: I3asara#2803
Профиль в steam: I3asara
Сроки: желательно сегодня, ближе к вечеру.
Цена: Обсудим в ЛС
Я вроде писалХотел бы поинтересоваться зачем нужен такой плагин)
А, не сразу увиделЯ вроде писал
[CS: GO] - Выдача decoy
Требуется написать плагин, который будет выдавать decoy всем на карте при спавне. Если игрок выбросил decoy, то выдать ему новый через 20 сек. И так выдавать пока он не умрет. Связь в Дискорд: I3asara#2803 Профиль в steam: I3asara Сроки: желательно сегодня, ближе к вечеру. Цена: Обсудим в ЛСhlmod.ru