mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-25 12:52:17 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a5b120674 | ||
|
|
5a24f3b9fa |
@@ -131,11 +131,27 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
||||||
{
|
{
|
||||||
var player = @event.Userid;
|
var player = @event.Userid;
|
||||||
if (!player.IsValid || !player.PlayerPawn.IsValid || player.IsBot)
|
if (!player.IsValid || !player.PlayerPawn.IsValid)
|
||||||
{
|
{
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
if (!PlayerHasKnife(player)) player.GiveNamedItem(g_playersKife[(int)player.EntityIndex!.Value.Value]);
|
if (player.IsBot)
|
||||||
|
{
|
||||||
|
player.GiveNamedItem("weapon_knife");
|
||||||
|
return HookResult.Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PlayerHasKnife(player))
|
||||||
|
{
|
||||||
|
if (g_playersKife.ContainsKey((int)player.EntityIndex!.Value.Value))
|
||||||
|
{
|
||||||
|
player.GiveNamedItem(g_playersKife[(int)player.EntityIndex!.Value.Value]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.GiveNamedItem("weapon_knife");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
@@ -187,6 +203,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
public void RemoveKnifeFromPlayer(CCSPlayerController player)
|
public void RemoveKnifeFromPlayer(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
if (!player.PawnIsAlive) return;
|
if (!player.PawnIsAlive) return;
|
||||||
|
if (!g_playersKife.ContainsKey((int)player.EntityIndex!.Value.Value)) return;
|
||||||
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
||||||
foreach (var weapon in weapons)
|
foreach (var weapon in weapons)
|
||||||
{
|
{
|
||||||
@@ -325,10 +342,6 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
{
|
{
|
||||||
g_playersKife[playerIndex] = knife;
|
g_playersKife[playerIndex] = knife;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_playersKife[playerIndex] = "weapon_knife";
|
|
||||||
}
|
|
||||||
//Log($"{player.PlayerName} has this knife -> {g_playersKife[playerIndex]}");
|
//Log($"{player.PlayerName} has this knife -> {g_playersKife[playerIndex]}");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -352,7 +365,6 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Log(string message)
|
private static void Log(string message)
|
||||||
{
|
{
|
||||||
Console.BackgroundColor = ConsoleColor.DarkGray;
|
Console.BackgroundColor = ConsoleColor.DarkGray;
|
||||||
|
|||||||
Reference in New Issue
Block a user