PHP Code:
#include <amxmodx>
#include <cstrike>
#define VIP_FLAG "z" // change this to the flag for VIP players
#define ADMIN_FLAG "a" // change this to the flag for admin players
public plugin_init() {
register_plugin("Free Weapon Skins", "1.0", "Author")
register_clcmd("say /skins", "cmd_skins")
}
public cmd_skins(id) {
if (!is_user_alive(id)) {
client_print(id, print_chat, "You must be alive to use this command.")
return PLUGIN_HANDLED
}
if (!get_user_flags(id) & VIP_FLAG && !get_user_flags(id) & ADMIN_FLAG) {
client_print(id, print_chat, "You must be a VIP or admin to use this command.")
return PLUGIN_HANDLED
}
new weapon = read_data(2)
if (weapon < CSW_P228 || weapon > CSW_M3) {
client_print(id, print_chat, "Invalid weapon id.")
return PLUGIN_HANDLED
}
new skin[64]
read_args(skin, 63)
if (!skin) {
client_print(id, print_chat, "Usage: /skins <weapon id> <skin>")
return PLUGIN_HANDLED
}
engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetPlayerWeaponSlot, id, weapon), "skin", skin)
client_print(id, print_chat, "Weapon skin applied.")
return PLUGIN_HANDLED
}
This plugin uses the register_clcmd function to register the command "/skins", which is then handled by the cmd_skins function. This function first checks if the player is alive, then checks if the player has the VIP or admin flag. If the player meets these requirements, the function then reads the weapon ID and skin from the command arguments, and sets the skin for the specified