#include <amxmodx>
#include <amxmisc>
#include <colorchat>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <codmod>
#define PLUGIN "Bonusowe Paczki"
#define VERSION "1.0"
#define AUTHOR "radim edytowal ricO"
new const modelitem[] = "models/cod_paczka.mdl";
new const prefix[] = "^04[BONUS]^01"
public plugin_init()
{
register_plugin(PLUGIN, AUTHOR, VERSION)
register_forward(FM_Touch, "fwd_touch")
register_event("DeathMsg", "DeathMsg", "a")
register_logevent("PoczatekRundy", 2, "1=Round_Start");
}
public plugin_precache()
{
precache_model(modelitem);
}
public PoczatekRundy()
kill_all_entity("paczka")
public DeathMsg()
{
new kid = read_data(1)
new vid = read_data(2)
if( kid == vid )
return PLUGIN_CONTINUE;
if(is_user_connected(kid) || is_user_connected(vid))
create_itm(vid, 0)
return PLUGIN_CONTINUE;
}
public UzyjPaczki(id, ent)
{
if( !is_user_connected(id) || !is_user_alive(id) || !pev_valid(ent))
return PLUGIN_HANDLED;
switch(random_num(1, 5))
{
case 1:
{
new hp = get_user_health(id);
new losowehp = random_num(-5, -20);
set_user_health(id, hp+losowehp)
ColorChat(id, GREY, "^x04%s ^x01Znalazles trucizne. Tracisz ^x03%i^x01 HP!", prefix, losowehp)
}
case 2:
{
new hp = get_user_health(id);
new losowehp = random_num(5, 40);
set_user_health(id, hp+losowehp)
ColorChat(id, GREY, "^x04%s ^x01Znalazles apteczke. Dostales ^x03%i^x01 HP!", prefix, losowehp)
}
case 3:
{
new kasa = cs_get_user_money(id);
new losowakasa = random_num(20, 5000);
cs_set_user_money(id, kasa+losowakasa)
ColorChat(id, GREY, "^x04%s ^x01Znalazles sakiewke ze zlotem. Dostales ^x03%i^x01 kasy!", prefix, losowakasa)
}
case 4:
{
ColorChat(id, GREY, "^x04%s ^x01Posiadasz juz perk!", prefix)
if(cod_get_user_perk(id))
return PLUGIN_HANDLED
cod_set_user_perk(id, -1, -1, 1);
}
case 5:
{
new explvl = (cod_get_user_level(id)+cod_get_user_level(pev(ent, pev_iuser2)))
cod_set_user_xp(id, cod_get_user_xp(id)+explvl)
ColorChat(id, GREY, "^x04%s ^x01Znalazles ^x03%i^x01 Expa!", prefix, explvl)
}
}
return PLUGIN_HANDLED;
}
public create_itm(id, id_item){
new Float:origins[3]
pev(id,pev_origin,origins);
new entit=create_entity("info_target")
origins[0]+=50.0
origins[2]-=32.0
set_pev(entit,pev_origin,origins)
entity_set_model(entit,modelitem)
set_pev(entit,pev_classname,"paczka");
dllfunc(DLLFunc_Spawn, entit);
set_pev(entit,pev_solid,SOLID_BBOX);
set_pev(entit,pev_movetype,MOVETYPE_FLY);
engfunc(EngFunc_SetSize,entit,{-1.1, -1.1, -1.1},{1.1, 1.1, 1.1});
engfunc(EngFunc_DropToFloor,entit);
set_pev(entit, pev_iuser1, id_item)
set_pev(entit, pev_iuser2, id)
}
public fwd_touch(ent,id)
{
if(!is_user_alive(id)) return FMRES_IGNORED;
if(!pev_valid(ent)) return FMRES_IGNORED;
static classname[32];
pev(ent,pev_classname,classname,31);
if(!equali(classname,"paczka")) return FMRES_IGNORED;
if(pev(id,pev_button))
{
{
UzyjPaczki(id, ent)
engfunc(EngFunc_RemoveEntity,ent);
}
}
return FMRES_IGNORED;
}
public kill_all_entity(classname[]) {
new iEnt = find_ent_by_class(-1, classname)
while(iEnt > 0) {
remove_entity(iEnt)
iEnt = find_ent_by_class(iEnt, classname)
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
Lecz nie sprawdzalem, gdyz na swoim laptopie nie posiadam
cs'a