Skip to content

Commit

Permalink
Merge pull request #191 from daffyyyy/main
Browse files Browse the repository at this point in the history
2.2b
  • Loading branch information
daffyyyy authored Mar 5, 2024
2 parents 88274d7 + 692c22f commit 651fae4
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 35 deletions.
1 change: 0 additions & 1 deletion Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ private void SetupSkinsMenu()
return false;
});


string selectedSkin = opt.Text;
string selectedPaintID = selectedSkin.Substring(selectedSkin.LastIndexOf('(') + 1).Trim(')');

Expand Down
2 changes: 2 additions & 0 deletions Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Additional

[JsonPropertyName("GloveEnabled")]
public bool GloveEnabled { get; set; } = true;

[JsonPropertyName("AgentEnabled")]
public bool AgentEnabled { get; set; } = true;

Expand All @@ -27,6 +28,7 @@ public class Additional

[JsonPropertyName("CommandGlove")]
public string CommandGlove { get; set; } = "gloves";

[JsonPropertyName("CommandAgent")]
public string CommandAgent { get; set; } = "agents";

Expand Down
10 changes: 5 additions & 5 deletions Events.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;

namespace WeaponPaints
Expand Down Expand Up @@ -265,10 +266,10 @@ public void OnEntitySpawned(CEntityInstance entity)
Server.NextFrame(() =>
{
var weapon = new CBasePlayerWeapon(entity.Handle);
if (!weapon.IsValid) return;
if (weapon == null || !weapon.IsValid || weapon.OwnerEntity.Value == null) return;

var player = Utilities.GetPlayerFromSteamId(weapon.OriginalOwnerXuidLow);
if (player == null || !Utility.IsPlayerValid(player)) return;
CCSPlayerController? player = Utilities.GetPlayerFromIndex((int)weapon.OwnerEntity.Value.Index);
if (player == null || !player.IsValid || !Utility.IsPlayerValid(player)) return;

GivePlayerWeaponSkin(player, weapon);
});
Expand All @@ -291,7 +292,6 @@ private void OnTick()
}
}


private void RegisterListeners()
{
RegisterListener<Listeners.OnMapStart>(OnMapStart);
Expand All @@ -301,7 +301,7 @@ private void RegisterListeners()
RegisterEventHandler<EventRoundEnd>(OnRoundEnd);
RegisterListener<Listeners.OnEntitySpawned>(OnEntitySpawned);
RegisterListener<Listeners.OnTick>(OnTick);
//VirtualFunctions.GiveNamedItemFunc.Hook(OnGiveNamedItemPost, HookMode.Post);
VirtualFunctions.GiveNamedItemFunc.Hook(OnGiveNamedItemPost, HookMode.Post);
}
}
}
6 changes: 6 additions & 0 deletions Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ internal static async Task CheckDatabaseTables()
`steamid` varchar(64) NOT NULL,
`weapon_defindex` int(11) NOT NULL,
UNIQUE (`steamid`)
) ENGINE=InnoDB",
@"CREATE TABLE `wp_player_agents` (
`steamid` varchar(64) NOT NULL,
`agent_ct` varchar(64) DEFAULT NULL,
`agent_t` varchar(64) DEFAULT NULL,
UNIQUE KEY `steamid` (`steamid`)
) ENGINE=InnoDB"
};

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2a
2.2b
5 changes: 3 additions & 2 deletions WeaponAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ internal void RefreshWeapons(CCSPlayerController? player)
});
}
}

}, TimerFlags.STOP_ON_MAPCHANGE);
}

Expand Down Expand Up @@ -297,8 +296,10 @@ public static void UpdatePlayerWeaponMeshGroupMask(CCSPlayerController player, C
}
}

public void GivePlayerAgent(CCSPlayerController player)
public static void GivePlayerAgent(CCSPlayerController player)
{
if (!g_playersAgent.ContainsKey(player.Slot)) return;

try
{
Server.NextFrame(() =>
Expand Down
2 changes: 1 addition & 1 deletion WeaponPaints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based";
public override string ModuleName => "WeaponPaints";
public override string ModuleVersion => "2.2a";
public override string ModuleVersion => "2.2b";

public static WeaponPaintsConfig GetWeaponPaintsConfig()
{
Expand Down
6 changes: 3 additions & 3 deletions WeaponSynchronization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ internal async Task SyncAgentToDatabase(PlayerInfo player)
{
await using var connection = await _database.GetConnectionAsync();
string query = @"
INSERT INTO `wp_player_agents` (`steamid`, `agent_ct`, `agent_t`)
VALUES(@steamid, @agent_ct, @agent_t)
ON DUPLICATE KEY UPDATE
INSERT INTO `wp_player_agents` (`steamid`, `agent_ct`, `agent_t`)
VALUES(@steamid, @agent_ct, @agent_t)
ON DUPLICATE KEY UPDATE
`agent_ct` = @agent_ct,
`agent_t` = @agent_t";

Expand Down
42 changes: 21 additions & 21 deletions gamedata/weaponpaints.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"ChangeSubclass": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x20\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\xE8\\x2A\\x2A\\x2A\\x2A\\x84\\xC0\\x74\\x2A\\x41\\xB0\\x01",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xA8\\x00\\x00\\x00"
}
},
"CAttributeList_SetOrAddAttributeValueByName": {
"signatures": {
"library": "server",
"windows": "\\x40\\x53\\x41\\x56\\x41\\x57\\x48\\x81\\xEC\\x90\\x00\\x00\\x00\\x0F\\x29\\x74\\x24\\x70",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xFE\\x41\\x55\\x41\\x54\\x49\\x89\\xF4\\x53\\x48\\x83\\xEC\\x78"
}
},
"CBaseModelEntity_SetBodygroup": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x74\\x24\\x10\\x57\\x48\\x83\\xEC\\x20\\x41\\x8B\\xF8\\x48\\x8B\\xF2\\x48\\x8B\\xD9\\xE8\\x2A\\x2A\\x2A\\x2A",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x48\\x83\\xEC\\x08"
}
}
"ChangeSubclass": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x20\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\xE8\\x2A\\x2A\\x2A\\x2A\\x84\\xC0\\x74\\x2A\\x41\\xB0\\x01",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xA8\\x00\\x00\\x00"
}
},
"CAttributeList_SetOrAddAttributeValueByName": {
"signatures": {
"library": "server",
"windows": "\\x40\\x53\\x41\\x56\\x41\\x57\\x48\\x81\\xEC\\x90\\x00\\x00\\x00\\x0F\\x29\\x74\\x24\\x70",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xFE\\x41\\x55\\x41\\x54\\x49\\x89\\xF4\\x53\\x48\\x83\\xEC\\x78"
}
},
"CBaseModelEntity_SetBodygroup": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x74\\x24\\x10\\x57\\x48\\x83\\xEC\\x20\\x41\\x8B\\xF8\\x48\\x8B\\xF2\\x48\\x8B\\xD9\\xE8\\x2A\\x2A\\x2A\\x2A",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xD5\\x41\\x54\\x49\\x89\\xFC\\x48\\x83\\xEC\\x08"
}
}
}
2 changes: 1 addition & 1 deletion website/data/agents.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"image": "",
"model": "null",
"agent_name": "Agent | Default"
},
},
{
"team": 3,
"image": "",
Expand Down

0 comments on commit 651fae4

Please sign in to comment.