OK i have been looking for plugin that easily changes the skin of a weapon, but found none that i could get to work. so i sarted making my own plugin.i found the source code of aim the ak which switches the skin and aims the ak. i used the code and changed all ak names directories etc. this is what i got
Code:
#include <amxmodx>
#include <engine>
#define PLUGIN "Aim the M4"
#define VERSION "1.0"
#define AUTHOR "BLADE"
new bool:AAK[33]
new LastWeapon[33]
new Float:PATime[33]
new Float: OldPA[33][3]
new Float:SwitchTime[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public plugin_precache()
{
precache_model("models/v_aimm4a1.mdl")
precache_model("models/v_m4a1.mdl")
}
public client_PreThink(id)
{
new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if(Weapon == CSW_m4a1 && Clip > 0)
{
if(get_user_button(id) & IN_ATTACK && AAK[id] && (PATime[id] + 0.1) < get_gametime())
{
new Float:PAPower[3]
entity_get_vector(id, EV_VEC_punchangle, PAPower)
for(new i = 0; i < 3; i++)
{
PAPower[i] = ((PAPower[i] + OldPA[id][i]) / 2)
OldPA[id][i] = PAPower[i]
}
entity_set_vector(id, EV_VEC_punchangle, PAPower)
PATime[id] = get_gametime()
LastWeapon[id] = Weapon
}
else if(get_user_oldbutton(id) & IN_ATTACK)
for(new i = 0; i < 3; i++) OldPA[id][i] = 0.0
if(get_user_button(id) & IN_ATTACK2)
{
if((SwitchTime[id] + 1.0) < get_gametime())
{
switch(AAK[id])
{
case true: AAK[id] = false
case false: AAK[id] = true
}
SwitchTime[id] = get_gametime()
}
}
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo)
if(Weapon == CSW_m4a1)
{
switch(AAK[id])
{
case true: entity_set_string(id, EV_SZ_viewmodel, "models/v_aimm4a1.mdl")
case false: entity_set_string(id, EV_SZ_viewmodel, "models/v_m4a1.mdl")
}
}
return PLUGIN_CONTINUE
}
but when i compile i get eror with CSW_m4a1 in both lines
PLZ HELP this is my first plugin and i am a noob at coding.