Zasięgnąłem dokumentacji public_paint_splat, fm set_user_origin i fm_set_user_velocity.
Jednak zmiany w kodzie nie przyniosły rezultatu żadnego czy ja muszę miec bibloteke specjalnie zeedytowana do kompilacji pb aby kulki leciały w poziomie czy jednak mozna zrobić to w sma... Broń o której mowie to pb sniper podmianka za scout'a... Pomóżcie Panowie...
Z góry dzięki...
moje sma:#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#define PLUGIN "Paintball Gun"
#define VERSION "5.10"
#define AUTHOR ""
#define MAX_PAINTBALLS 200
#define TASK_PB_RESET 1000
#define TASK_RELOAD 2000
#define CROSSHAIR_REMOVED ( 1<<6 )
#define PB_MARKER 1
#define PB_USP 2
#define PB_GLOCK 3
#define PB_SNIPER 4
#define PB_SUPERMARKER 7
new g_msgHideWeapon;
new g_paintballs[MAX_PAINTBALLS], g_pbstatus[MAX_PAINTBALLS], g_pbcount, Float:lastshot[33], Float:nextattack[33], freezetime;
new pbgun, color, shots, blife, sound, bglow, damage, friendlyfire, beamspr;
new knife_ohk, jamon, pellets_real;
new fire_rate_low, fire_rate_medium, fire_rate_high, jam_prob_low, jam_prob_high, gravity, speed_marker, speed_pistol, speed_sniper, dispersion, removecrosshair, speed_smarker ;
static const g_shot_anim[8] = {0, 3, 9, 5, 1, 1, 1, 3};
static const g_pbgun_models[11][] = {"models/v_pbgun.mdl", "models/v_pbgun1.mdl", "models/v_pbgun2.mdl", "models/v_pbgun3.mdl", "models/v_pbgun4.mdl", "models/v_pbgun5.mdl", "models/v_pbgun6.mdl", "models/v_pbgun7.mdl", "models/v_pbgun8.mdl", "models/v_pbgun9.mdl", "models/v_pbgun10.mdl"};
new g_Jammed[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /ent", "ent_info", ADMIN_SLAY);
g_msgHideWeapon = get_user_msgid( "HideWeapon" );
if (get_pcvar_num(pbgun))
{
register_event("CurWeapon", "ev_curweapon", "be");
register_logevent("ev_roundstart", 2, "0=World triggered", "1=Round_Start");
if (get_cvar_num("mp_freezetime") > 0)
register_event("HLTV", "ev_freezetime", "a", "1=0", "2=0");
register_forward(FM_Touch, "fw_touch");
register_forward(FM_SetModel, "fw_setmodel");
register_forward(FM_CmdStart, "fw_cmdstart");
register_forward(FM_UpdateClientData, "fw_updateclientdata",1);
RegisterHam ( Ham_TakeDamage, "player", "fwd_TakeDamage" );
RegisterHam (Ham_Weapon_Reload, "weapon_m3", "fw_reload", 1);
RegisterHam (Ham_Weapon_Reload, "weapon_xm1014", "fw_reload", 1);
RegisterHam (Ham_Weapon_Reload, "weapon_scout", "fw_reload", 1);
set_cvar_num ("sv_maxvelocity", 4000);
new a, max_ents_allow = global_get(glb_maxEntities) - 5;
for (a = 1; a <= get_pcvar_num(shots); a++)
if (a < MAX_PAINTBALLS)
if (engfunc(EngFunc_NumberOfEntities) < max_ents_allow)
{
g_paintballs[a] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (pev_valid(g_paintballs[a]))
{
set_pev(g_paintballs[a], pev_effects, pev(g_paintballs[a], pev_effects) | EF_NODRAW);
g_pbcount++;
}
}
if (g_pbcount < 1)
set_fail_state("[amxx] Failed to load Realism for Paintball Gun (unable to create ents)");
}
}
public plugin_precache()
{
pbgun = register_cvar("amx_pbgun", "1");
knife_ohk = register_cvar("amx_knifeonehitkill", "1");
jamon = register_cvar("amx_pbgun_jam","1");
friendlyfire = get_cvar_pointer("mp_friendlyfire");
if (get_pcvar_num(pbgun)) {
color = register_cvar("pbgun_color", "1");
shots = register_cvar("pbgun_shots", "100");
blife = register_cvar("pbgun_life", "15");
sound = register_cvar("pbgun_sound", "1");
bglow = register_cvar("pbgun_glow", "c");
damage = register_cvar("pbgun_damage", "100");
fire_rate_low = register_cvar("pbgun_fireratelow", "1.1");
fire_rate_high = register_cvar("pbgun_fireratehigh", "0.16");
fire_rate_medium = register_cvar("pbgun_fireratemedium", "0.7");
jam_prob_low = register_cvar("pbgun_jamproblow", "30");
jam_prob_high = register_cvar("pbgun_jamprobhigh", "100");
gravity = register_cvar("pbgun_gravity", "1");
speed_marker = register_cvar("pbgun_velocity_marker", "2000");
speed_smarker = register_cvar("pbgun_velocity_super_marker", "2500");
speed_pistol = register_cvar("pbgun_velocity_pistol", "1500");
speed_sniper = register_cvar("pbgun_velocity_sniper", "4000");
dispersion = register_cvar("pbgun_dispersion", "100");
removecrosshair = register_cvar("pbgun_nocrosshair", "1");
pellets_real = register_cvar("pbgun_real_pellets", "1");
precache_model(g_pbgun_models[3]);
precache_model(g_pbgun_models[7]);
precache_model("models/v_pbgun1.mdl");
precache_model("models/v_pbgun6.mdl");
precache_model("models/p_pbgun.mdl");
precache_model("models/p_pbgun1.mdl");
precache_model("models/w_pbgun.mdl");
precache_model("models/v_pb_sniper.mdl");
precache_model("models/p_pb_sniper.mdl");
precache_model("models/w_pb_sniper.mdl");
precache_model("models/v_pb_.mdl");
precache_model("models/p_pb_.mdl");
precache_model("models/w_pb_.mdl");
precache_model("models/w_pb_launch_he.mdl");
precache_model("models/p_pb_knife.mdl");
precache_model("models/v_pb_knife.mdl");
precache_model("models/v_pbusp.mdl");
precache_model("models/p_pbusp.mdl");
precache_model("models/v_pbglock.mdl");
precache_model("models/p_pbglock.mdl");
precache_sound("misc/pb1.wav");
precache_sound("misc/pb2.wav");
precache_sound("misc/pb3.wav");
precache_sound("misc/pb4.wav");
precache_sound("misc/pbg.wav");
precache_model("models/w_paintball.mdl");
precache_model("sprites/paintball.spr");
precache_sound("weapons/scout_fire-1.wav");
precache_sound("weapons/dryfire_pistol.wav");
precache_sound("weapons/scout_bolt.wav");
precache_sound("weapons/draw.wav");
precache_sound("weapons/insert.wav");
precache_sound("weapons/magin.wav");
precache_sound("weapons/magout.wav");
precache_sound("weapons/magrel.wav");
precache_sound("weapons/pullout.wav");
precache_sound("weapons/roll.wav");
}
beamspr = precache_model("sprites/laserbeam.spr");
}
public ent_info(id)
client_print(id, print_chat, "[amxx] [Ent Info (Current/Max)] Paintballs: (%d/%d) Entities: (%d/%d)", g_pbcount, get_pcvar_num(shots), engfunc(EngFunc_NumberOfEntities), global_get(glb_maxEntities));
public ev_curweapon(id)
{
//replace the weapon model with the PB model
new model[25];
pev(id, pev_viewmodel2, model, 24);
if (equali(model, "models/v_mp5.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, (get_user_team(id) == 1) ? g_pbgun_models[3] : g_pbgun_models[7]);
set_pev(id, pev_weaponmodel2, "models/p_pbgun1.mdl");
}
else if (equali(model, "models/v_usp.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, "models/v_pbusp.mdl");
set_pev(id, pev_weaponmodel2, "models/p_pbusp.mdl");
}
else if (equali(model, "models/v_glock18.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, "models/v_pbglock.mdl");
set_pev(id, pev_weaponmodel2, "models/p_pbglock.mdl");
}else if (equali(model, "models/v_scout.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, "models/v_pb_sniper.mdl");
set_pev(id, pev_weaponmodel2, "models/p_pb_sniper.mdl");
}else if (equali(model, "models/v_knife.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, "models/v_pb_knife.mdl");
set_pev(id, pev_weaponmodel2, "models/p_pb_knife.mdl");
}else if (equali(model, "models/v_p90.mdl") && get_pcvar_num(pbgun))
{
set_pev(id, pev_viewmodel2, (get_user_team(id) == 1) ? "models/v_pbgun1.mdl" : "models/v_pbgun6.mdl" );
set_pev(id, pev_weaponmodel2, "models/p_pbgun1.mdl");
}
if (user_has_pbgun(id)){
if (get_pcvar_num(removecrosshair))
{
//Remove the crosshair
message_begin( MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id );
write_byte( CROSSHAIR_REMOVED );
message_end();
}
}
}
public fw_setmodel(ent, model[])
{
//replace dropped models with PB models
if (equali(model, "models/w_mp5.mdl") || equali(model, "models/w_p90.mdl"))
if (get_pcvar_num(pbgun))
{
engfunc(EngFunc_SetModel, ent, "models/w_pbgun.mdl");
return FMRES_SUPERCEDE;
}
if (equali(model, "models/w_scout.mdl"))
if (get_pcvar_num(pbgun))
{
engfunc(EngFunc_SetModel, ent, "models/w_pb_sniper.mdl");
return FMRES_SUPERCEDE;
}
if (equali(model, "models/w_xm1014.mdl"))
if (get_pcvar_num(pbgun))
{
engfunc(EngFunc_SetModel, ent, "models/w_pb_.mdl");
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public fw_updateclientdata(id, sw, cd_handle)
{
//this function overrides the client side sounds and stuff
if (user_has_pbgun(id) && cd_handle)
{
set_cd(cd_handle, CD_ID, 1);
get_cd(cd_handle, CD_flNextAttack, nextattack[id]);
return FMRES_HANDLED;
}
return FMRES_IGNORED;
}
public fw_reload(weapon)
{
new id = pev(weapon, pev_owner)
new ammo, null = get_user_weapon(id, ammo, null);
new my_pbgun = user_has_pbgun(id)
if ((my_pbgun == PB_SNIPER && ammo < 10))
{
lastshot[id] = get_gametime();
set_hudmessage(255, 255, 255, -1.0, 0.33, 0, 1.0, 1.0);
show_hudmessage(id, "Przeladowywanie...");
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
write_byte(3);
write_byte(0);
message_end();
}
}
public try_to_jam(id, my_pbgun){
//chance of jamming the current weapon
if(get_pcvar_num(jamon) && !g_Jammed[id] && my_pbgun != PB_GLOCK && my_pbgun != PB_USP && !is_user_bot(id))
{
new average_usage_jam;
switch (my_pbgun)
{
case PB_MARKER: average_usage_jam = get_pcvar_num(jam_prob_high);
case PB_GLOCK: average_usage_jam = get_pcvar_num(jam_prob_high);
case PB_USP: average_usage_jam = get_pcvar_num(jam_prob_high);
case PB_SNIPER: average_usage_jam = get_pcvar_num(jam_prob_low);
case PB_SUPERMARKER: average_usage_jam = get_pcvar_num(jam_prob_high) * 2;
default: average_usage_jam = get_pcvar_num(jam_prob_high);
}
new jam = (random(average_usage_jam)==0);
if(jam)
{
emit_sound(id,CHAN_AUTO, "weapons/dryfire_pistol.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
g_Jammed[id] = my_pbgun;
}
}
}
public fw_cmdstart( id, uc_handle, random_seed )
{
if ( !is_user_alive( id ) )
return FMRES_IGNORED
static buttons; buttons = get_uc( uc_handle, UC_Buttons )
new my_pbgun = user_has_pbgun(id);
//if jammed, clear the chamber
if ( buttons & IN_USE && my_pbgun == g_Jammed[id] && my_pbgun && get_pcvar_num(jamon))
clear_chamber(id);
//if he is shooting with a PBGUN
if ( buttons & IN_ATTACK && my_pbgun)
{
//check if weapon is jammed
if(g_Jammed[id] == my_pbgun && !is_user_bot(id) && get_pcvar_num(jamon))
{
weapon_jam(id, uc_handle);
return FMRES_IGNORED;
}
set_uc (uc_handle, UC_Buttons, buttons & ~IN_ATTACK);
new ammo, null = get_user_weapon(id, ammo, null);
if (ammo)
{
new Float:gametime = get_gametime(), Float:g_speed;
switch (my_pbgun)
{
case PB_MARKER: g_speed = get_pcvar_float(fire_rate_high);
case PB_GLOCK: g_speed = get_pcvar_float(fire_rate_high);
case PB_USP: g_speed = get_pcvar_float(fire_rate_high);
case PB_SNIPER: g_speed = get_pcvar_float(fire_rate_low);
case PB_SUPERMARKER: g_speed = get_pcvar_float(fire_rate_high)/2.0;
default: g_speed = get_pcvar_float(fire_rate_high);
}
new cangofull = (my_pbgun == PB_MARKER || my_pbgun == PB_SUPERMARKER);
//check that the button was not pressed before or that the weapon can go full-auto
new auto = !(pev(id, pev_oldbuttons) & IN_ATTACK) || cangofull;
//check the fire-rate and freezetime
if (gametime-lastshot[id] > g_speed && (is_user_bot(id) || nextattack[id] < 0.0) && !freezetime && auto)
{
new fired;
if (my_pbgun == PB_SNIPER)
{ //shoot 5 pellets
for (new a = 0; a < 5; a++)
fired = paint_fire(id, a) || fired;
}
else //shoot 1 pellet
fired = paint_fire(id, 0);
if (fired)
{
lastshot[id] = gametime;
set_user_clip(id, ammo - 1);
//show the animation
set_pev(id, pev_punchangle, Float:{-0.5, 0.0, 0.0});
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
write_byte(g_shot_anim[my_pbgun]);
write_byte(0);
message_end();
//shooting sound
if (get_pcvar_num(sound))
if (my_pbgun != PB_SNIPER)
emit_sound(id, CHAN_AUTO, "misc/pbg.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
else
emit_sound(id, CHAN_AUTO, "weapons/scout_fire-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
try_to_jam(id,my_pbgun)
}
}
}
return FMRES_IGNORED;
}
return FMRES_IGNORED
}
public paint_fire(id, num)
{
new a, ent;
while (a++ < g_pbcount - 1 && !ent)
if (g_pbstatus[a] == 0)
ent = g_pbstatus[a] = g_paintballs[a];
if (!ent)
while (a-- > 1 && !ent)
if (g_pbstatus[a] == 2)
ent = g_pbstatus[a] = g_paintballs[a];
if (pev_valid(ent) && is_user_alive(id))
{
new Float:vangles[3], Float:nvelocity[3], Float:voriginf[3], vorigin[3], clr;
set_pev(ent, pev_owner, id);
new my_pbgun = user_has_pbgun(id);
set_pev(ent, pev_classname, "pbBullet");
engfunc(EngFunc_SetModel, ent, "models/w_paintball.mdl");
if (my_pbgun == PB_SNIPER) //make them smaller to avoid creation collisions
engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{1.0, 1.0, 1.0});
else
engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0});
switch (get_pcvar_num(color))
{
case 2: clr = (get_user_team(id) == 1) ? 0 : 1;
case 3: clr = (get_user_team(id) == 1) ? 4 : 3;
case 4: clr = (get_user_team(id) == 1) ? 2 : 5;
default: clr = random_num(0, 6);
}
set_pev(ent, pev_skin, clr);
set_pev(ent, pev_gravity, 0.5);
get_user_origin(id, vorigin, 1);
if (my_pbgun == PB_SNIPER)
{ //avoid creation collisions
vorigin[0] += random(5)-2;
vorigin[1] += random(5)-2;
vorigin[2] += num*5
}
IVecFVec(vorigin, voriginf);
engfunc(EngFunc_SetOrigin, ent, voriginf);
vangles[0] = random_float(-180.0, 180.0);
vangles[1] = random_float(-180.0, 180.0);
set_pev(ent, pev_angles, vangles);
pev(id, pev_v_angle, vangles);
set_pev(ent, pev_v_angle, vangles);
pev(id, pev_view_ofs, vangles);
set_pev(ent, pev_view_ofs, vangles);
new veloc;
if (get_pcvar_num(gravity))
set_pev(ent, pev_movetype, MOVETYPE_BOUNCE);
else
set_pev(ent, pev_movetype, MOVETYPE_FLY);
set_pev(ent, pev_solid, 2);
//Different guns shoot at different speeds
switch (my_pbgun)
{
case PB_MARKER: veloc = get_pcvar_num(speed_marker);
case PB_GLOCK: veloc = get_pcvar_num(speed_pistol);
case PB_USP: veloc = get_pcvar_num(speed_pistol);
case PB_SNIPER: veloc = get_pcvar_num(speed_sniper);
case PB_SUPERMARKER: veloc = get_pcvar_num(speed_smarker);
default: veloc = get_pcvar_num(speed_pistol);
}
velocity_by_aim(id, veloc, nvelocity);
//Fix aim for bots
if (is_user_bot(id))
switch (my_pbgun)
{
case PB_MARKER: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0;
case PB_GLOCK: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0;
case PB_USP: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0;
case PB_SNIPER: nvelocity[2] += (get_pcvar_num(gravity))? 35 : 0;
case PB_SUPERMARKER: nvelocity[2] += (get_pcvar_num(gravity))? 100 : 0;
default: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0;
}
//Recoil!!!
if (cs_get_user_zoom(id)== CS_SET_NO_ZOOM){
//the sniper will shoot terribly bad without a scope
new modifier = (my_pbgun != PB_SNIPER)? 1 : 5;
new buttons = pev(id, pev_button);
if (my_pbgun == PB_SNIPER)
modifier = 2;
else //shoot worse while moving
if (buttons & IN_JUMP || buttons & IN_FORWARD || buttons & IN_BACK || buttons & IN_MOVELEFT || buttons & IN_MOVERIGHT)
modifier *= 2;
new disp = get_pcvar_num(dispersion);
nvelocity[0] += (random(disp)-disp/2) * modifier;
nvelocity[1] += (random(disp)-disp/2) * modifier;
nvelocity[2] += (random(disp)-disp/2) * modifier;
}
set_pev(ent, pev_velocity, nvelocity);
set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW);
//glow
set_task(0.1, "paint_glow", ent);
set_task(15.0 , "paint_reset", ent+TASK_PB_RESET);
}
return ent;
}
public fw_touch(bullet, ent)
{
new class[20];
pev(bullet, pev_classname, class, 19);
if (!equali(class, "pbBullet")&&!equali(class, "pbHarmlessBullet"))
return FMRES_IGNORED;
new owner = pev(bullet, pev_owner);
new Float:origin[3], class2[20], is_ent_alive = is_user_alive(ent);
pev(ent, pev_classname, class2, 19);
pev(bullet, pev_origin, origin);
//The bullet hits or bounces
new hit;
hit = random(5);
if (is_ent_alive) //make damage
{
if (owner == ent || pev(ent, pev_takedamage) == DAMAGE_NO)
return FMRES_IGNORED;
if (get_user_team(owner) == get_user_team(ent))
if (!get_pcvar_num(friendlyfire))
return FMRES_IGNORED;
if (hit != 0 && !equali(class, "pbHarmlessBullet"))
ExecuteHam(Ham_TakeDamage, ent, owner, owner, get_pcvar_float(damage), 4098);
}
if (!equali(class2, "pbBullet")&&!equali(class2, "pbHarmlessBullet"))
if (hit != 0 || !get_pcvar_num(pellets_real))
{ //stop the pellet and make a splat
set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0});
set_pev(bullet, pev_classname, "pbPaint");
set_pev(bullet, pev_solid, 0);
set_pev(bullet, pev_movetype, 0);
engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr");
new a, findpb = 0;
while (a++ < g_pbcount && !findpb)
if (g_paintballs[a] == bullet)
findpb = g_pbstatus[a] = 2;
remove_task(bullet);
remove_task(bullet+TASK_PB_RESET);
if (get_pcvar_num(sound))
{
static wav[20];
formatex(wav, 20, is_ent_alive ? "player/pl_pain%d.wav" : "misc/pb%d.wav", is_ent_alive ? random_num(4,7) : random_num(1,4));
emit_sound(bullet, CHAN_AUTO, wav, 1.0, ATTN_NORM, 0, PITCH_NORM);
}
new bool:valid_surface = (is_ent_alive || containi(class2, "door") != -1) ? false : true;
if (pev(ent, pev_health) && !is_ent_alive)
{
ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(pev(ent, pev_health)), 0);
valid_surface = false;
}
if (valid_surface)
{
paint_splat(bullet);
set_task(float(get_pcvar_num(blife)), "paint_reset", bullet+TASK_PB_RESET);
}
else
paint_reset(bullet+TASK_PB_RESET);
return FMRES_HANDLED;
}else
{ //the pellet bounces, reduce its speed
if (get_pcvar_num(gravity)){
new Float:vel[3];
pev(bullet,pev_velocity,vel);
vel[0] /= 10.0;
vel[1] /= 10.0;
vel[2] /= 10.0;
set_pev(bullet, pev_velocity, vel);
}
//A bullet that bounces becomes harmless to players
set_pev(bullet, pev_classname, "pbHarmlessBullet");
return FMRES_IGNORED;
}
/*else
{
paint_reset(bullet+TASK_PB_RESET);
return FMRES_HANDLED;
}
*/
return FMRES_IGNORED;
}
public paint_splat(ent)
{
new Float:origin[3], Float:norigin[3], Float:viewofs[3], Float:angles[3], Float:normal[3], Float:aiming[3];
pev(ent, pev_origin, origin);
pev(ent, pev_view_ofs, viewofs);
pev(ent, pev_v_angle, angles);
norigin[0] = origin[0] + viewofs[0];
norigin[1] = origin[1] + viewofs[1];
norigin[2] = origin[2] + viewofs[2];
aiming[0] = norigin[0] + floatcos(angles[1], degrees) * 1000.0;
aiming[1] = norigin[1] + floatsin(angles[1], degrees) * 1000.0;
aiming[2] = norigin[2] + floatsin(-angles[0], degrees) * 1000.0;
new tr = 0
engfunc(EngFunc_TraceLine, norigin, aiming, 0, ent, tr);
//get_tr2(tr, TR_vecPlaneNormal, normal);
//EngFunc_TraceHull,(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
//engfunc(EngFunc_TraceHull, norigin, aiming, 0, HULL_LARGE, ent, tr)
get_tr2(tr, TR_vecPlaneNormal, normal)
vector_to_angle(normal, angles);
angles[1] += 180.0;
if (angles[1] >= 360.0) angles[1] -= 360.0;
set_pev(ent, pev_angles, angles);
set_pev(ent, pev_v_angle, angles);
origin[0] += (normal[0] * random_float(0.3, 2.7));
origin[1] += (normal[1] * random_float(0.3, 2.7));
origin[2] += (normal[2] * random_float(0.3, 2.7));
engfunc(EngFunc_SetOrigin, ent, origin);
set_pev(ent, pev_frame, float(random_num( (pev(ent, pev_skin) * 18), (pev(ent, pev_skin) * 18) + 17 ) ));
if (pev(ent, pev_renderfx) != kRenderFxNone)
set_rendering(ent);
}
public paint_glow(ent)
{
if (pev_valid(ent))
{
static pbglow[5], clr[3];
get_pcvar_string(bglow, pbglow, 4);
switch (get_pcvar_num(color))
{
case 2: clr = (get_user_team(pev(ent, pev_owner))==1) ? {255, 0, 0} : {0, 0, 255};
default: clr = {255, 255, 255};
}
if (read_flags(pbglow) & (1 << 0))
set_rendering(ent, kRenderFxGlowShell, clr[0], clr[1], clr[2], kRenderNormal, 255);
if (read_flags(pbglow) & (1 << 1))
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMFOLLOW);
write_short(ent);
write_short(beamspr);
write_byte(4);
write_byte(2);
write_byte(clr[0]);
write_byte(clr[1]);
write_byte(clr[2]);
write_byte(255);
message_end();
}
}
}
public paint_reset(ent)
{
remove_task(ent);
ent -= TASK_PB_RESET;
new a, findpb = 1;
while (a++ <= g_pbcount && findpb)
if (g_paintballs[a] == ent)
findpb = g_pbstatus[a] = 0;
set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW);
engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0});
set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0});
engfunc(EngFunc_SetOrigin, ent, Float:{-2000.0, -2000.0, -2000.0});
if (pev(ent, pev_renderfx) != kRenderFxNone)
set_rendering(ent);
}
public ev_roundstart()
{
for (new a = 1; a <= g_pbcount; a++)
if (g_pbstatus[a] != 0)
paint_reset(g_paintballs[a]+TASK_PB_RESET);
if (freezetime)
freezetime = 0;
}
public ev_freezetime()
freezetime = 1;
stock user_has_pbgun(id)
{
new retval;
if (is_user_alive(id))
{
switch(get_user_weapon(id))
{
case CSW_MP5NAVY: retval = PB_MARKER;
case CSW_USP: retval = PB_USP;
case CSW_GLOCK18: retval = PB_GLOCK;
case CSW_SCOUT: retval = PB_SNIPER;
case CSW_P90: retval = PB_SUPERMARKER;
default: retval = 0;
}
}
return retval;
}
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;
}
// teame06's function
stock set_rendering(index, fx=kRenderFxNone, r=0, g=0, b=0, render=kRenderNormal, amount=16)
{
set_pev(index, pev_renderfx, fx);
new Float:RenderColor[3];
RenderColor[0] = float®;
RenderColor[1] = float(g);
RenderColor[2] = float( ;
set_pev(index, pev_rendercolor, RenderColor);
set_pev(index, pev_rendermode, render);
set_pev(index, pev_renderamt, float(amount));
}
public fwd_TakeDamage ( id, i_Inflictor, i_Attacker, Float:f_Damage, i_DamageBits )
{
if (!is_user_alive(i_Attacker))
return PLUGIN_CONTINUE;
if ( get_user_weapon(i_Attacker) == CSW_KNIFE && get_pcvar_num(knife_ohk))
{
ExecuteHam(Ham_TakeDamage, id, i_Attacker, i_Attacker, 101.0, 4098);
}
return PLUGIN_CONTINUE;
}
public weapon_jam(id, uc_handle)
{
if (get_pcvar_num(jamon))
{
// show messages
set_hudmessage(255, 255, 255, -1.0, 0.33, 0, 6.0, 12.0)
show_hudmessage(id, "Zaciela Ci sie bron - kliknij klawisz domyslnie (e)")
// block the attack button
static buttons; buttons = get_uc( uc_handle, UC_Buttons )
set_uc (uc_handle, UC_Buttons, buttons & ~IN_ATTACK);
}
}
public clear_chamber(id)
{
if (get_pcvar_num(jamon))
{
g_Jammed[id] = false;
emit_sound(id,CHAN_AUTO,"weapons/scout_bolt.wav",1.0,ATTN_NORM,0,PITCH_NORM);
// show messages
set_hudmessage(255, 255, 255, -1.0, 0.3, 0, 3.0, 12.0);
show_hudmessage(id, "wyczysc");
}
}
public make_solid(ent)
{
remove_task(ent);
ent -= TASK_PB_RESET;
if (!pev_valid(ent))
return;
set_pev(ent, pev_solid, 2);
if (get_pcvar_num(gravity))
set_pev(ent, pev_movetype, MOVETYPE_BOUNCE);
}
Załączone pliki
-
paintballgun1.sma 23,12 KB 75 Ilość pobrań
paintballgun1.amxx