To przykladowy plik .smg z klasa premium jak ja przerobic na zwykla klase????
#include <amxmodx>
#include <amxmisc>
#include <codmod>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#include <fakemeta>
#include <fun>
new const nazwa[] = "Mega Rambo";
new const opis[] = "Posiada 1/1 z HE, 1/3 z scouta i dostaje pelny magazynek za fraga";
new const bronie = (1<<CSW_SCOUT)|(1<<CSW_M4A1)|(1<<CSW_HEGRENADE);
new const zdrowie = 45;
new const kondycja = 30;
new const inteligencja = 15;
new const wytrzymalosc = 25;
new bool:ma_klase[33];
#define DMG_BULLET (1<<1)
#define DMG_HEGRENADE (1<<24)
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 };
public plugin_init()
{
register_plugin(nazwa, "1.0", "Enson");
cod_register_class(nazwa, opis, bronie, zdrowie, kondycja, inteligencja, wytrzymalosc);
RegisterHam(Ham_TakeDamage, "player", "TakeDamage");
register_event("DeathMsg", "DeathMsg", "ade");
}
public cod_class_enabled(id)
{
if(!(get_user_flags(id) & ADMIN_LEVEL_H))
{
ColorChat(id, GREY, "[%s] Nie masz uprawnien, aby uzywac tej klasy.", nazwa);
return COD_STOP;
}
ma_klase[id] = true;
give_item(id, "weapon_hegrenade");
ColorChat(id, GREY, "[COD:MW3] Klasa %s stworzona przez Enson.", nazwa);
return COD_CONTINUE;
}
public cod_class_disabled(id)
ma_klase[id] = false;
public TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(!is_user_connected(idattacker))
return HAM_IGNORED;
if(!ma_klase[idattacker])
return HAM_IGNORED;
if(damagebits & DMG_BULLET)
{
new weapon = get_user_weapon(idattacker);
if(weapon == CSW_SCOUT && damage > 20.0 && random_num(1, 3) == 1)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
}
if(damagebits & DMG_HEGRENADE)
cod_inflict_damage(idattacker, this, float(get_user_health(this))-damage+1.0, 0.0, idinflictor, damagebits);
return HAM_IGNORED;
}
public DeathMsg()
{
new killer = read_data(1);
if(!is_user_connected(killer))
return PLUGIN_CONTINUE;
if(ma_klase[killer])
{
new cur_health = pev(killer, pev_health);
new Float:max_health = 100.0+cod_get_user_health(killer);
new Float:new_health = cur_health+20.0<max_health? cur_health+20.0: max_health;
set_pev(killer, pev_health, new_health);
new weapon = get_user_weapon(killer);
if(maxClip[weapon] != -1)
set_user_clip(killer, maxClip[weapon]);
}
return PLUGIN_CONTINUE;
}
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;
}