mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-23 04:00:37 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
953788c327 | ||
|
|
837b000126 | ||
|
|
87a78b01b4 | ||
|
|
f7c914a267 | ||
|
|
2c0fad230d |
@@ -8,11 +8,13 @@
|
|||||||
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
Unfinished, unoptimized and not fully functional ugly demo weapon paints plugin for [CSSharp](https://docs.cssharp.dev/).
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
- changes only paint, seed, wear on weapons
|
- changes only paint, seed and wear on weapons and knives
|
||||||
- mysql based
|
- mysql based
|
||||||
- data sync on player connect or playe
|
- data sync on player connect
|
||||||
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
|
- Added command `!wp` to refresh skins (with cooldown in second can be configured)
|
||||||
- Added command `!ws` to show website
|
- Added command `!ws` to show website
|
||||||
|
- Added command `!knife` to show menu with knives
|
||||||
|
- Knife change is now limited to have these cvars empty `mp_t_default_melee ""` and `mp_ct_default_melee ""`
|
||||||
|
|
||||||
### CS2 server:
|
### CS2 server:
|
||||||
- compile and copy plugin to plugins. Info here [https://docs.cssharp.dev/guides/hello-world-plugin/](https://docs.cssharp.dev/guides/hello-world-plugin/)
|
- compile and copy plugin to plugins. Info here [https://docs.cssharp.dev/guides/hello-world-plugin/](https://docs.cssharp.dev/guides/hello-world-plugin/)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using CounterStrikeSharp.API;
|
using CounterStrikeSharp.API;
|
||||||
using CounterStrikeSharp.API.Core;
|
using CounterStrikeSharp.API.Core;
|
||||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||||
using CounterStrikeSharp.API.Modules.Commands;
|
using CounterStrikeSharp.API.Modules.Commands;
|
||||||
@@ -8,6 +8,7 @@ using CounterStrikeSharp.API.Modules.Menu;
|
|||||||
using CounterStrikeSharp.API.Modules.Utils;
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
using Nexd.MySQL;
|
using Nexd.MySQL;
|
||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
|
using static CounterStrikeSharp.API.Core.Listeners;
|
||||||
|
|
||||||
namespace WeaponPaints;
|
namespace WeaponPaints;
|
||||||
public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
||||||
@@ -67,7 +68,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
SetGlobalExceptionHandler();
|
SetGlobalExceptionHandler();
|
||||||
MySql = new MySqlDb(Config.DatabaseHost, Config.DatabaseUser, Config.DatabasePassword, Config.DatabaseName!, Config.DatabasePort);
|
MySql = new MySqlDb(Config.DatabaseHost, Config.DatabaseUser, Config.DatabasePassword, Config.DatabaseName!, Config.DatabasePort);
|
||||||
RegisterListener<Listeners.OnEntitySpawned>(OnEntitySpawned);
|
RegisterListener<Listeners.OnEntitySpawned>(OnEntitySpawned);
|
||||||
RegisterListener<Listeners.OnClientAuthorized>(OnClientAuthorized);
|
RegisterListener<Listeners.OnClientPutInServer>(OnClientPutInServer);
|
||||||
RegisterListener<Listeners.OnClientDisconnect>(OnClientDisconnect);
|
RegisterListener<Listeners.OnClientDisconnect>(OnClientDisconnect);
|
||||||
RegisterListener<Listeners.OnMapStart>(OnMapStart);
|
RegisterListener<Listeners.OnMapStart>(OnMapStart);
|
||||||
RegisterEventHandler<EventPlayerSpawn>(OnPlayerSpawn);
|
RegisterEventHandler<EventPlayerSpawn>(OnPlayerSpawn);
|
||||||
@@ -113,7 +114,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientAuthorized(int playerSlot, SteamID steamId)
|
private void OnClientPutInServer(int playerSlot)
|
||||||
{
|
{
|
||||||
int playerIndex = playerSlot + 1;
|
int playerIndex = playerSlot + 1;
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
@@ -301,8 +302,9 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
gPlayerWeaponSeed[steamId.SteamId64][WeaponDefIndex] = Seed;
|
gPlayerWeaponSeed[steamId.SteamId64][WeaponDefIndex] = Seed;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Log(e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +333,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.Message);
|
Log(e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,9 +346,9 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
var steamId = new SteamID(player.SteamID);
|
var steamId = new SteamID(player.SteamID);
|
||||||
await MySql!.ExecuteNonQueryAsync($"INSERT INTO `wp_player_knife` (`steamid`, `knife`) VALUES('{steamId.SteamId64}', '{knife}') ON DUPLICATE KEY UPDATE `knife` = '{knife}';");
|
await MySql!.ExecuteNonQueryAsync($"INSERT INTO `wp_player_knife` (`steamid`, `knife`) VALUES('{steamId.SteamId64}', '{knife}') ON DUPLICATE KEY UPDATE `knife` = '{knife}';");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log(ex.Message);
|
Log(e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user