у меня есть несколько джетпаков
с базукой и без
я для шопменю 3 искал самый легкий код
могу скинуть
надо немного продправит ь для вашего сервера
зато код негрузит серв
Цитата
#include <amxmodx>
#include <cstrike>
#include <engine>
new const PLUGIN[] = "Jetpack Ultra light";
new const VERSION[] = "1.0";
new const AUTHOR[] = "cs-portal";
new const CVAR_JP_SPEED[] = "jp_speed";
new bool:has_jp[33];
new bool:has_started;
new frame[33];
new current_jps;
public plugin_init() {
register_plugin(PLUGIN , VERSION , AUTHOR);
register_cvar(CVAR_JP_SPEED , "800");
register_event("DeathMsg" , "Event_DeathMsg" , "a");
register_event("HLTV" , "did_not_start" , "a" , "1=0" , "2=0");
register_logevent("did_start" , 2 , "1=Round_Start");
register_touch("jetpack" , "player" , "mmm_touchy");
}
public did_not_start() {
has_started = false;
new ent = -1;
while((ent = find_ent_by_class(ent , "jetpack")) != 0) {
remove_entity(ent);
}
current_jps = 0;
new aPlayers[32] , iNum , i;
get_players(aPlayers , iNum);
for(i = 1; i <= iNum; i++) {
if(has_jp[aPlayers[i]]) {
current_jps++;
}
}
}
public did_start() {
has_started = true;
}
public client_connect(id) {
has_jp[id] = false;
}
public client_disconnect(id) {
has_jp[id] = false;
}
public plugin_precache() {
precache_model("models/p_egon.mdl");
precache_model("models/w_egon.mdl");
}
public client_PreThink(id) {
if(!is_user_connected(id) || !is_user_alive(id)) {
return PLUGIN_CONTINUE;
}
if(!(get_user_button(id) & IN_JUMP)) {
return PLUGIN_CONTINUE;
}
if(!has_started || !has_jp[id]) {
return PLUGIN_CONTINUE;
}
new Float:fAim[3] , Float:fVelocity[3];
VelocityByAim(id , get_cvar_num(CVAR_JP_SPEED) , fAim);
fVelocity[0] = fAim[0];
fVelocity[1] = fAim[1];
fVelocity[2] = fAim[2];
set_user_velocity(id , fVelocity);
entity_set_int(id , EV_INT_gaitsequence , 6);
if(frame[id] >= 3) {
frame[id] = 0;
entity_set_string(id , EV_SZ_weaponmodel , "models/p_egon.mdl");
}
frame[id]++;
return PLUGIN_CONTINUE;
}
public Event_DeathMsg()
has_jp[read_data(2)] = false;
public ClCmd_BuyJP(id) {
if(!is_user_alive(id)) {
client_print(id , print_chat , "[zz] You cannot buy a jetpack when you are dead!");
return PLUGIN_HANDLED;
}
if(has_jp[id]) {
client_print(id , print_chat , "[zz] You already have a jetpack!");
return PLUGIN_HANDLED;
}
if(current_jps > 4) {
client_print(id , print_chat , "[zz] Pa3PEWEHO ToJIbko 4 JETPAKA CPA3y HA CEPBEPE!");
return PLUGIN_HANDLED;
}
has_jp[id] = true;
emit_sound(id , CHAN_VOICE , "items/gunpickup2.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM);
current_jps++;
return PLUGIN_HANDLED;
}
public drop_jp(id) {
if(!has_jp[id]) return PLUGIN_HANDLED;
new Float:fAim[3] , Float:fOrigin[3];
VelocityByAim(id , 64 , fAim);
entity_get_vector(id , EV_VEC_origin , fOrigin);
fOrigin[0] += fAim[0];
fOrigin[1] += fAim[1];
new jp = create_entity("info_target");
entity_set_string(jp , EV_SZ_classname , "jetpack");
entity_set_model(jp , "models/w_egon.mdl");
entity_set_size(jp , Float:{-16.0,-16.0,-16.0} , Float:{16.0,16.0,16.0});
entity_set_int(jp , EV_INT_solid , 1);
entity_set_int(jp , EV_INT_movetype , 6);
entity_set_vector(jp , EV_VEC_origin , fOrigin);
has_jp[id] = false;
return PLUGIN_HANDLED;
}
public mmm_touchy(jp , id) {
if(!is_user_alive(id)) return PLUGIN_CONTINUE;
if(has_jp[id]) return PLUGIN_CONTINUE;
has_jp[id] = true;
emit_sound(id , CHAN_VOICE , "items/gunpickup2.wav" , 1.0 , ATTN_NORM , 0 , PITCH_NORM);
remove_entity(jp);
return PLUGIN_CONTINUE;
}
public Enable_Item(id){
has_jp[id] = true;
ClCmd_BuyJP(id)
}
public Disable_Item(id) {
has_jp[id] = false;
drop_jp(id)
}