Mam problem z klasa buguje się tzn awp jest 1/1 raz działa a raz nie jak działa to i z deagla też mam 1/1 plus małe info gdzie popełniłem błąd.
Spoiler
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>
#include <codmod>
//KONFIGURACJA
#define FLAGA ADMIN_LEVEL_B //Na jaka flage dostepna jest klasa premium?
new g_iKlasaGracza[33];
new const maxClip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
new const g_szSkin[][][] = {
{"arctic","leet","guerilla","terror"},
{"sas","gsg9","urban","gign"}
};
public plugin_init()
{
new const szNazwa[] = "Zawodowy Snajper [Premium]";
new const szOpis[] = "Natychmiastowe zabicie z AWP, +10%% z deagle'a, na siedzaco jest niewidoczny, posiada wyglad wroga oraz dostaje full maazynek za fraga";
new const iBronie = (1<<CSW_AWP)|(1<<CSW_DEAGLE);
new const iZdrowie = 50;
new const iKondycja = 40;
new const iInteligencja = 20;
new const iWytrzymalosc = 30;
register_plugin(szNazwa, "1.0", "d0naciak");
cod_register_class(szNazwa, szOpis, iBronie, iZdrowie, iKondycja, iInteligencja, iWytrzymalosc);
RegisterHam(Ham_Spawn, "player", "fw_Spawn_Post", 1);
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
RegisterHam(Ham_Killed, "player", "fw_Killed_Post", 1);
register_forward(FM_CmdStart, "fw_CmdStart");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & FLAGA))
{
client_print(id, print_chat, "Nie masz uprawnien aby korzystac z tej klasy!");
return COD_STOP;
}
g_iKlasaGracza[id] = 1;
return COD_CONTINUE;
}
public cod_class_disabled(id)
g_iKlasaGracza[id] = 0;
public fw_Spawn_Post(id)
{
if(!is_user_alive(id) || !g_iKlasaGracza[id])
return HAM_IGNORED;
new iTeam = get_user_team(id);
if(1 <= iTeam <= 2)
cs_set_user_model(id, g_szSkin[iTeam - 1][random(4)]);
return HAM_IGNORED;
}
public fw_TakeDamage(id, iEnt, iAttacker, Float:fDamage, iDamageBits)
{
if(!is_user_connected(id) || !is_user_connected(iAttacker) || !g_iKlasaGracza[iAttacker] || get_user_team(id) == get_user_team(iAttacker))
return HAM_IGNORED;
static iWeapon;
iWeapon = get_user_weapon(id);
if(iWeapon == CSW_AWP)
{
cod_inflict_damage(iAttacker, id, float(get_user_health(id) + 1), 0.0, iEnt, (1<<1));
return HAM_IGNORED;
}
else if(iWeapon == CSW_DEAGLE)
cod_inflict_damage(iAttacker, id, fDamage * 0.1, 0.0, iEnt, (1<<1));
return HAM_IGNORED;
}
public fw_Killed_Post(vId, kId)
{
if(!is_user_alive(kId) || !g_iKlasaGracza[kId])
return HAM_IGNORED;
new iWeapon = get_user_weapon(kId);
if(maxClip[iWeapon] != -1)
set_user_clip(kId, maxClip[iWeapon]);
return HAM_IGNORED;
}
public fw_CmdStart(id, iUc)
{
if(!is_user_alive(id) || !g_iKlasaGracza[id] )
return FMRES_IGNORED;
static iButtons ,iOldButtons;
iButtons = get_uc(iUc, UC_Buttons)
iOldButtons = pev(id, pev_oldbuttons);
if(iButtons & IN_DUCK && !(iOldButtons & IN_DUCK) && get_user_weapon(id) == CSW_KNIFE)
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderTransAlpha,10);
else if(!(iButtons & IN_DUCK) && iOldButtons & IN_DUCK)
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderTransAlpha,255);
return FMRES_IGNORED;
}
stock set_user_clip(id, ammo)
{
new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
get_weaponname(weapon, weaponname, 31);
while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
if (pev(weaponid, pev_owner) == id) {
set_pdata_int(weaponid, 51, ammo, 4);
return weaponid;
}
return 0;
}
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>
#include <codmod>
//KONFIGURACJA
#define FLAGA ADMIN_LEVEL_B //Na jaka flage dostepna jest klasa premium?
new g_iKlasaGracza[33];
new const maxClip[31] = { -1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
new const g_szSkin[][][] = {
{"arctic","leet","guerilla","terror"},
{"sas","gsg9","urban","gign"}
};
public plugin_init()
{
new const szNazwa[] = "Zawodowy Snajper [Premium]";
new const szOpis[] = "Natychmiastowe zabicie z AWP, +10%% z deagle'a, na siedzaco jest niewidoczny, posiada wyglad wroga oraz dostaje full maazynek za fraga";
new const iBronie = (1<<CSW_AWP)|(1<<CSW_DEAGLE);
new const iZdrowie = 50;
new const iKondycja = 40;
new const iInteligencja = 20;
new const iWytrzymalosc = 30;
register_plugin(szNazwa, "1.0", "d0naciak");
cod_register_class(szNazwa, szOpis, iBronie, iZdrowie, iKondycja, iInteligencja, iWytrzymalosc);
RegisterHam(Ham_Spawn, "player", "fw_Spawn_Post", 1);
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
RegisterHam(Ham_Killed, "player", "fw_Killed_Post", 1);
register_forward(FM_CmdStart, "fw_CmdStart");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & FLAGA))
{
client_print(id, print_chat, "Nie masz uprawnien aby korzystac z tej klasy!");
return COD_STOP;
}
g_iKlasaGracza[id] = 1;
return COD_CONTINUE;
}
public cod_class_disabled(id)
g_iKlasaGracza[id] = 0;
public fw_Spawn_Post(id)
{
if(!is_user_alive(id) || !g_iKlasaGracza[id])
return HAM_IGNORED;
new iTeam = get_user_team(id);
if(1 <= iTeam <= 2)
cs_set_user_model(id, g_szSkin[iTeam - 1][random(4)]);
return HAM_IGNORED;
}
public fw_TakeDamage(id, iEnt, iAttacker, Float:fDamage, iDamageBits)
{
if(!is_user_connected(id) || !is_user_connected(iAttacker) || !g_iKlasaGracza[iAttacker] || get_user_team(id) == get_user_team(iAttacker))
return HAM_IGNORED;
static iWeapon;
iWeapon = get_user_weapon(id);
if(iWeapon == CSW_AWP)
{
cod_inflict_damage(iAttacker, id, float(get_user_health(id) + 1), 0.0, iEnt, (1<<1));
return HAM_IGNORED;
}
else if(iWeapon == CSW_DEAGLE)
cod_inflict_damage(iAttacker, id, fDamage * 0.1, 0.0, iEnt, (1<<1));
return HAM_IGNORED;
}
public fw_Killed_Post(vId, kId)
{
if(!is_user_alive(kId) || !g_iKlasaGracza[kId])
return HAM_IGNORED;
new iWeapon = get_user_weapon(kId);
if(maxClip[iWeapon] != -1)
set_user_clip(kId, maxClip[iWeapon]);
return HAM_IGNORED;
}
public fw_CmdStart(id, iUc)
{
if(!is_user_alive(id) || !g_iKlasaGracza[id] )
return FMRES_IGNORED;
static iButtons ,iOldButtons;
iButtons = get_uc(iUc, UC_Buttons)
iOldButtons = pev(id, pev_oldbuttons);
if(iButtons & IN_DUCK && !(iOldButtons & IN_DUCK) && get_user_weapon(id) == CSW_KNIFE)
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderTransAlpha,10);
else if(!(iButtons & IN_DUCK) && iOldButtons & IN_DUCK)
fm_set_user_rendering(id,kRenderFxNone,255,255,255,kRenderTransAlpha,255);
return FMRES_IGNORED;
}
stock set_user_clip(id, ammo)
{
new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _);
get_weaponname(weapon, weaponname, 31);
while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0)
if (pev(weaponid, pev_owner) == id) {
set_pdata_int(weaponid, 51, ammo, 4);
return weaponid;
}
return 0;
}