New Member
|
02-23-2024
, 19:49
Command hat and weapon
|
#1
|
Command hat:
Spoiler
#include <sourcemod>
enum HatType {
HAT_NONE,
HAT_SOLDIER,
HAT_PYRO,
HAT_HEAVY,
// Add more hat types here as needed
HAT_MAX
}
enum PaintType {
PAINT_NONE,
PAINT_TEAMSPIRIT,
PAINT_PINK,
PAINT_GREEN,
// Add more paint types here as needed
PAINT_MAX
}
enum StyleType {
STYLE_NONE,
STYLE_NORMAL,
STYLE_FANCY,
STYLE_CUSTOM,
// Add more style types here as needed
STYLE_MAX
}
enum UnusualType {
UNUSUAL_NONE,
UNUSUAL_STORMY_STORM,
UNUSUAL_ORBITING_FIRE,
UNUSUAL_PLANETARY_PROBE,
// Add more unusual types here as needed
UNUSUAL_MAX
}
struct Hat {
HatType type;
PaintType paint;
StyleType style;
UnusualType unusual;
}
enum PlayerSlot {
SLOT_HAT1,
SLOT_HAT2,
SLOT_HAT3,
SLOT_HAT4,
SLOT_HAT5,
SLOT_HAT6,
SLOT_MAX
}
Hat g_PlayerHats[SLOT_MAX];
void ShowHatMenu(int client) {
PrintToChat(client, "Hat Menu:");
for (int i = 0; i < SLOT_MAX; i++) {
PrintToChat(client, Format("%d. Equip Hat %d", i+1, i+1));
}
PrintToChat(client, "7. Manage Hat Options");
}
void EquipHat(int client, int slot) {
if (slot < 0 || slot >= SLOT_MAX) {
PrintToChat(client, "Invalid hat slot!");
return;
}
// Equip the hat for the player
g_PlayerHats[slot].type = /* Get hat type */;
// Update player's appearance with the new hat
}
void ManageHatOptions(int client) {
PrintToChat(client, "Manage Hat Options:");
PrintToChat(client, "1. Apply Paint");
PrintToChat(client, "2. Change Style");
PrintToChat(client, "3. Add Unusual Effect");
}
void ApplyPaint(int client, int slot, PaintType paint) {
g_PlayerHats[slot].paint = paint;
}
void ChangeStyle(int client, int slot, StyleType style) {
g_PlayerHats[slot].style = style;
}
void AddUnusualEffect(int client, int slot, UnusualType unusual) {
g_PlayerHats[slot].unusual = unusual;
}
void OnPluginStart() {
RegisterCommand("!hat", "Show the hat menu", "ShowHatMenu", ADMFLAG_GENERIC);
RegisterCommand("equiphat", "Equip a hat", "EquipHat", ADMFLAG_GENERIC);
RegisterCommand("managehatoptions", "Manage hat options", "ManageHatOptions", ADMFLAG_GENERIC);
RegisterCommand("applypaint", "Apply paint to a hat", "ApplyPaint", ADMFLAG_GENERIC);
RegisterCommand("changestyle", "Change the style of a hat", "ChangeStyle", ADMFLAG_GENERIC);
RegisterCommand("addunusualeffect", "Add an unusual effect to a hat", "AddUnusualEffect", ADMFLAG_GENERIC);
}
Command weapon:
Spoiler
#include <sourcemod>
enum WeaponType {
WEAPON_NONE,
WEAPON_SCATTERGUN,
WEAPON_ROCKET_LAUNCHER,
WEAPON_FLAMETHROWER,
// Add more weapon types here as needed
WEAPON_MAX
}
enum ModifierType {
MODIFIER_NONE,
MODIFIER_AUSTRALIUM,
MODIFIER_WARPAINT,
MODIFIER_SPELLS,
MODIFIER_FESTIVIZER,
MODIFIER_KILLSTREAK,
// Add more modifier types here as needed
MODIFIER_MAX
}
struct Weapon {
WeaponType type;
ModifierType modifier;
}
enum PlayerSlot {
SLOT_PRIMARY,
SLOT_SECONDARY,
SLOT_MELEE,
SLOT_MAX
}
Weapon g_PlayerWeapons[SLOT_MAX];
void ShowWeaponMenu(int client) {
PrintToChat(client, "Weapon Menu:");
for (int i = 0; i < SLOT_MAX; i++) {
PrintToChat(client, Format("%d. Equip Weapon %d", i+1, i+1));
}
PrintToChat(client, "4. Manage Weapon Options");
}
void EquipWeapon(int client, int slot) {
if (slot < 0 || slot >= SLOT_MAX) {
PrintToChat(client, "Invalid weapon slot!");
return;
}
// Equip the weapon for the player
g_PlayerWeapons[slot].type = /* Get weapon type */;
// Update player's loadout with the new weapon
}
void ManageWeaponOptions(int client) {
PrintToChat(client, "Manage Weapon Options:");
PrintToChat(client, "1. Apply Australium");
PrintToChat(client, "2. Apply Warpaint");
PrintToChat(client, "3. Apply Spells");
PrintToChat(client, "4. Apply Festivizer");
PrintToChat(client, "5. Apply Killstreak");
}
void ApplyModifier(int client, int slot, ModifierType modifier) {
g_PlayerWeapons[slot].modifier = modifier;
}
void OnPluginStart() {
RegisterCommand("!weapon", "Show the weapon menu", "ShowWeaponMenu", ADMFLAG_GENERIC);
RegisterCommand("equipweapon", "Equip a weapon", "EquipWeapon", ADMFLAG_GENERIC);
RegisterCommand("manageweaponoptions", "Manage weapon options", "ManageWeaponOptions", ADMFLAG_GENERIC);
RegisterCommand("applymodifier", "Apply a modifier to a weapon", "ApplyModifier", ADMFLAG_GENERIC);
}
Are the codes ok? I'm new to this
|
|