#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
public Action:CS_OnCSWeaponDrop(client, weaponIndex)
{
decl String:sWeapon[64];
GetEntityClassname(weaponIndex, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "scout")) return Plugin_Continue;
return Plugin_Handled;
}
Оно же стандартно выпадает. У тебя исчезает?
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
public Action:CS_OnCSWeaponDrop(client, weaponIndex)
{
if(IsPlayerAlive(client))
{
decl String:sWeapon[64];
GetEntityClassname(weaponIndex, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "scout")) return Plugin_Continue;
else return Plugin_Handled;
}
return Plugin_Continue;
}
#pragma semicolon 1
#include <sourcemod>
#include <cstrike>
new bool:g_bIsAlive[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Pre);
HookEvent("player_spawn", Event_OnPlayerSpawn);
}
public Event_OnPlayerDeath(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
g_bIsAlive[GetClientOfUserId(GetEventInt(hEvent, "userid"))] = false;
}
public Event_OnPlayerSpawn(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
g_bIsAlive[GetClientOfUserId(GetEventInt(hEvent, "userid"))] = true;
}
public Action:CS_OnCSWeaponDrop(iClient, weaponIndex)
{
if(g_bIsAlive[iClient])
{
decl String:sWeapon[64];
GetEntityClassname(weaponIndex, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "scout")) return Plugin_Continue;
else return Plugin_Handled;
}
return Plugin_Continue;
}
Я их едва ли знаю.SDKHooks_DropWeapon
#include <cstrike>
new bool:g_bIsAlive[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Pre);
HookEvent("player_spawn", Event_OnPlayerSpawn);
}
public Event_OnPlayerDeath(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
g_bIsAlive[GetClientOfUserId(GetEventInt(hEvent, "userid"))] = false;
PrintToChatAll("Dead!!! g_bIsAlive = %d.", g_bIsAlive[GetClientOfUserId(GetEventInt(hEvent, "userid"))]);
}
public Event_OnPlayerSpawn(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
g_bIsAlive[GetClientOfUserId(GetEventInt(hEvent, "userid"))] = true;
}
public Action:CS_OnCSWeaponDrop(iClient, weaponIndex)
{
if(g_bIsAlive[iClient])
{
PrintToChatAll("Drop!!! g_bIsAlive = %d.", g_bIsAlive[iClient]);
decl String:sWeapon[64];
GetEntityClassname(weaponIndex, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "scout")) return Plugin_Continue;
else return Plugin_Handled;
}
return Plugin_Continue;
}
#include <cstrike>
new bool:g_bIsAlive[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("player_death", Event_OnPlayerDeath, EventHookMode_Pre);
HookEvent("player_spawn", Event_OnPlayerSpawn);
}
public Event_OnPlayerDeath(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(iClient) g_bIsAlive[iClient] = false;
PrintToChat(iClient, "Dead!!! g_bIsAlive = %d.", g_bIsAlive[iClient]);
}
public Event_OnPlayerSpawn(Handle:hEvent, const String:name[], bool:dontBroadcast)
{
new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(iClient) g_bIsAlive[iClient] = true;
PrintToChat(iClient, "Spawn!!! g_bIsAlive = %d.", g_bIsAlive[iClient]);
}
public Action:CS_OnCSWeaponDrop(iClient, weaponIndex)
{
if(g_bIsAlive[iClient])
{
PrintToChat(iClient, "Drop!!! g_bIsAlive = %d.", g_bIsAlive[iClient]);
decl String:sWeapon[64];
GetEntityClassname(weaponIndex, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "scout")) return Plugin_Continue;
else return Plugin_Handled;
}
return Plugin_Continue;
}
...если при 1 спавне от ботов не оставалось оружия. Вот это да. :)лучше было бы
заодно и короче:GetEventInt(event, "health")
#include <cstrike>
new bool:lock[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("player_hurt", PlayerHurt, EventHookMode_PostNoCopy);
HookEvent("player_spawn", PlayerSpawn, EventHookMode_PostNoCopy);
}
public PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetEventInt(event, "health") < 1) lock[GetClientOfUserId(GetEventInt(event, "userid"))] = false;
}
public PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) lock[GetClientOfUserId(GetEventInt(event, "userid"))] = true;
public Action:CS_OnCSWeaponDrop(client, index)
{
if (IsClientInGame(client) && lock[client])
{
decl String:weapon[25];
GetEntityClassname(index, weapon, sizeof(weapon));
if(StrEqual(weapon[7], "scout")) return Plugin_Continue;
else return Plugin_Handled;
}
return Plugin_Continue;
}