Русское сообщество по скриптингу

Просмотр 2х Кодов

Все вопросы по работе и настройке AMXX и его плагинов.

Модератор: liFe iS GoOD

Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела "Болтовня".
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.

В данном разделе форума разрешено создавать темы, касающие только вопросов по AMX Mod X и его плагинам.

Просмотр 2х Кодов

Сообщение MayroN » 01 мар 2019, 17:37

Посмотрите пожалуйста эти 2 Кода или проверьте у себя по возможности

1.zp_zclass_paokai.
Огонь работает - но не своих, ни противников неподжигает.С реальными людьми непроверял,но на Ботов недействует.Или же в плагине так задумано без повреждений Ботов?
Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <zombieplague>
 
 
new smoke
new fire
new burning
new isburning
[33]
//new flame_count[33]
new tkcount[33]
new gmsgDeathMsg
new gmsgScoreInfo
new bool
:flame[33]
new const CVAR_JP_SPEED[]  = "jp_speed";
 
 
// Zombie Atributes
new const zclass_name[] = { "Дракон" } // name
new const zclass_info[] = { "Летает [Огонь]" } // description
new const zclass_model[] = { "paokai" } // model
new const zclass_clawmodel[] = { "v_paokai.mdl" } // claw model
const zclass_health = 5000 // health
const zclass_speed = 340 // speed
const Float:zclass_gravity = 0.30// gravity
const Float:zclass_knockback = 1.3 // knockback
 
// Class IDs
new g_zflame
 
// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
   fire = precache_model("sprites/explode1.spr")
   smoke = precache_model("sprites/steam1.spr")
   burning = precache_model("sprites/xfire.spr")
   precache_sound("ambience/burning1.wav")
   precache_sound("ambience/flameburst1.wav")
   precache_sound("scientist/c1a0_sci_catscream.wav")
   precache_sound("vox/_period.wav")
   precache_sound("player/headshot2.wav")
   // Register the new class and store ID for reference
   g_zflame = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)   
}
 
public client_PreThink
(id) 
{
   if(!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE
   if
(zp_get_user_zombie_class(id) != g_zflame) return PLUGIN_CONTINUE
    
   new Float
:fAim[3] , Float:fVelocity[3];
   VelocityByAim(id , get_cvar_num(CVAR_JP_SPEED) , fAim);
    
   if
(!(get_user_button(id) & IN_JUMP))
   {
      fVelocity[0] = fAim[0];
      fVelocity[1] = fAim[1];
      fVelocity[2] = fAim[2];
 
      set_user_velocity
(id , fVelocity);
   }
   return PLUGIN_CONTINUE;
}
 
public plugin_init
()
{
   register_plugin("[ZP] Zombie Paokai", "1.2", "LARP")
   register_cvar(CVAR_JP_SPEED    , "200");
   register_cvar("amx_flamethrower_tkpunish1", "0")
   register_cvar("amx_flamethrower_tkpunish2", "0")
   register_cvar("amx_fl_hp", "800")
   register_logevent("round_start", 2, "1=Round_Start")
   register_logevent("round_end", 2, "1=Round_End")
   register_forward(FM_PlayerPreThink,"FM_PreThink")
    
}
// User Infected forward
public zp_user_infected_post(id, infector)
{
          
   
// Check if the infected player is using our custom zombie class
   if (zp_get_user_zombie_class(id) == g_zflame)
   {
      new cost = get_cvar_num("amx_fl_hp");
      fire_flamethrower(id);
      print_chatColor(id, "\g[ Зомби Чума ]\n \tВыпуск Огня\n - \g[E]\n.\tС каждого использования Вы теряете\n \g%d %% Здоровья\n", cost)
      flame[id]=true
   
}
    
}
 
/*public cmd_flamita(id)
{
   if(!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE
   if (zp_get_user_zombie_class(id) == g_zflame)
   {
      fire_flamethrower(id)
   }
   return PLUGIN_HANDLED
}*/
 
fire_flamethrower
(id){
 
      emit_sound
(id, CHAN_WEAPON, "ambience/flameburst1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
      //client_cmd(id, "bind mouse3 lallamitaywea")
      new vec[3]
      new aimvec[3]
      new velocityvec[3]
      new length
      new speed 
= 10
      get_user_origin
(id,vec)
      get_user_origin(id,aimvec,2)
      new dist = get_distance(vec,aimvec)
 
      new speed1 
= 160
      new speed2 
= 350
      new radius 
= 105
 
      if
(dist < 50){
         radius = 0
         speed 
= 5
      
}
      else if(dist < 150){
         speed1 = speed2 = 1
         speed 
= 5
         radius 
= 50
      
}
      else if(dist < 200){
         speed1 = speed2 = 1
         speed 
= 5
         radius 
= 90
      
}
      else if(dist < 250){
         speed1 = speed2 = 90
         speed 
= 6
         radius 
= 90
      
}
      else if(dist < 300){
         speed1 = speed2 = 140
         speed 
= 7
      
}
      else if(dist < 350){
         speed1 = speed2 = 190
         speed 
= 7
      
}
      else if(dist < 400){
         speed1 = 150
         speed2 
= 240
         speed 
= 8
      
}
      else if(dist < 450){
         speed1 = 150
         speed2 
= 290
         speed 
= 8
      
}
      else if(dist < 500){
         speed1 = 180
         speed2 
= 340
         speed 
= 9
      
}
      else if(dist < 550){
         speed1 = 180
         speed2 
= 340
         speed 
= 10
      
}
      else if(dist < 600){
         speed1 = 250
         speed2 
= 360
         speed 
= 11
      
}
      else if(dist < 660){
         speed1 = 280
         speed2 
= 390
         speed 
= 12
      
}
      velocityvec[0]=aimvec[0]-vec[0]
      velocityvec[1]=aimvec[1]-vec[1]
      velocityvec[2]=aimvec[2]-vec[2]
      length=sqrt(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocity
vec
[2]*velocityvec[2])
      velocityvec[0]=velocityvec[0]*speed/length
      velocityvec
[1]=velocityvec[1]*speed/length
      velocityvec
[2]=velocityvec[2]*speed/length
 
      new args
[8]
      args[0] = vec[0]
      args[1] = vec[1]
      args[2] = vec[2]
      args[3] = velocityvec[0]
      args[4] = velocityvec[1]
      args[5] = velocityvec[2]
      set_task(0.1,"te_spray",0,args,8,"a",2)
      check_burnzone(id,vec,aimvec,speed1,speed2,radius)
      //set_task(0.5,"client_bind",id)
             
      return PLUGIN_CONTINUE
 
}
 
public te_spray
(args[]){
 
   
//TE_SPRAY
   message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
   write_byte (120) // Throws a shower of sprites or models
   write_coord(args[0]) // start pos
   write_coord(args[1])
   write_coord(args[2])
   write_coord(args[3]) // velocity
   write_coord(args[4])
   write_coord(args[5])
   write_short (fire) // spr
   write_byte (8) // count
   write_byte (70) // speed
   write_byte (100) //(noise)
   write_byte (5) // (rendermode)
   message_end()
 
   return PLUGIN_CONTINUE
}
 
 
public sqrt
(num) {
   new div = num
   new result 
= 1
   while 
(div > result) { // end when div == result, or just below
      div = (div + result) / 2 // take mean value as new divisor
      result = num / div
   
}
   return div
}
 
check_burnzone
(id,vec[],aimvec[],speed1,speed2,radius){
   new maxplayers = get_maxplayers()+1
   new tid
, tbody
   get_user_aiming
(id,tid,tbody,550)
   if((tid > 0) && (tid < maxplayers)){
         burn_victim(tid,id,0)
      /*if(cvar_exists("mp_friendlyfire")){
         new ffcvar = get_cvar_num("mp_friendlyfire")
         if( (ffcvar == 0) || ((ffcvar == 1) && (get_cvar_num("amx_flamethrower_obeyffcvar") == 0)) ){
            if(get_user_team(tid) != get_user_team(id))
               burn_victim(tid,id,1)
         }
         else {
            if(get_user_team(tid) == get_user_team(id))
               burn_victim(tid,id,1)
            else
               burn_victim(tid,id,1)
         }
      }else{
         burn_victim(tid,id,0)
      }*/
   }
 
   new burnvec1
[3],burnvec2[3],length1
 
   burnvec1
[0]=aimvec[0]-vec[0]
   burnvec1[1]=aimvec[1]-vec[1]
   burnvec1[2]=aimvec[2]-vec[2]
 
   length1
=sqrt(burnvec1[0]*burnvec1[0]+burnvec1[1]*burnvec1[1]+burnvec1[2]*burnvec
1
[2])
   burnvec2[0]=burnvec1[0]*speed2/length1
   burnvec2
[1]=burnvec1[1]*speed2/length1
   burnvec2
[2]=burnvec1[2]*speed2/length1
   burnvec1
[0]=burnvec1[0]*speed1/length1
   burnvec1
[1]=burnvec1[1]*speed1/length1
   burnvec1
[2]=burnvec1[2]*speed1/length1
   burnvec1
[0] += vec[0]
   burnvec1[1] += vec[1]
   burnvec1[2] += vec[2]
   burnvec2[0] += vec[0]
   burnvec2[1] += vec[1]
   burnvec2[2] += vec[2]
 
   new origin
[3]
   for (new i=1; i<=maxplayers; i++) {
      if(cvar_exists("mp_friendlyfire")){
         new ffcvar = get_cvar_num("mp_friendlyfire")
         if( (ffcvar == 0) || ((ffcvar == 1) && (get_cvar_num("amx_flamethrower_obeyffcvar") == 0)) ){
            if(get_user_team(i) != get_user_team(id)){
               if((is_user_alive(i) == 1) && (!= id)){
                  get_user_origin(i,origin)
                  if(get_distance(origin,burnvec1) < radius)
                     burn_victim(i,id,1)
                  else if(get_distance(origin,burnvec2) < radius)
                     burn_victim(i,id,1)
               }
            }
 
         
}
         else {
            if((is_user_alive(i) == 1) && (!= id)){
               get_user_origin(i,origin)
               if(get_user_team(i) == get_user_team(id)){
                  if(get_distance(origin,burnvec1) < radius)
                     burn_victim(i,id,1)
                  else if(get_distance(origin,burnvec2) < radius)
                     burn_victim(i,id,1)
               }else{
                  if(get_distance(origin,burnvec1) < radius)
                     burn_victim(i,id,1)
                  else if(get_distance(origin,burnvec2) < radius)
                     burn_victim(i,id,1)
               }
            }
         }
      }
      else {
         if((is_user_alive(i) == 1) && (!= id)){
            get_user_origin(i,origin)
            if(get_distance(origin,burnvec1) < radius)
               burn_victim(i,id,1)
            else if(get_distance(origin,burnvec2) < radius)
               burn_victim(i,id,1)
 
         
}
      }
   }
   return PLUGIN_CONTINUE
}
 
burn_victim
(id,killer,tk){
   if(isburning[id] == 1)
      return PLUGIN_CONTINUE
 
   isburning
[id] = 1
 
   emit_sound
(id, CHAN_ITEM, "ambience/burning1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
 
   new hp
,args[4]
   hp = get_user_health(id)
   if(hp > 250)
      hp = 250
   args
[0] = id
   args
[1] = killer
   args
[2] = tk
   set_task
(0.3,"on_fire",451,args,4,"a",hp / 10)
   set_task(0.7,"fire_scream",0,args,4)
   set_task(5.5,"stop_firesound",0,args,4)
 
   if
(tk == 1){
      new namea[32]
      get_user_name(killer,namea,31)
      new teama[32]
      get_user_team(killer,teama,31)
      new players[32],pNum
      get_players
(players,pNum,"e",teama)
      for(new i=0;i<pNum;i++)
         //client_print(players[i],print_chat,"%s  attacked a teammate",namea)
         client_print(players[i],print_chat,"",namea)
      new punish1 = get_cvar_num("amx_flamethrower_tkpunish1")
      new punish2 = get_cvar_num("amx_flamethrower_tkpunish2")
      if(punish1 > 2){
         user_kill(killer,0)
         //set_hudmessage(255,50,50, -1.0, 0.45, 0, 0.02, 10.0, 1.01, 1.1, 16)
         //show_hudmessage(killer,"YOU WERE KILLED^nFOR ATTACKING TEAMMATES.^nSEE THAT IT HAPPENS NO MORE!")
         server_cmd("echo Plugin By LARP^^!", tk)
      }
       
      tkcount
[killer] +=1
      if
((punish1) && (tkcount[killer] > punish2 - 1)){
         if(punish1 == 1 || punish1 == 3)
            server_cmd("echo Plugin By LARP^^!")
         else if(punish1 == 2 || punish1 == 4){
            server_cmd("echo Plugin By LARP^^!")
            new authida[35]
            get_user_authid(killer,authida,34)
            if (equal("4294967295",authida)){
               new ipa[32]
               get_user_ip(killer,ipa,31,1)
               server_cmd("echo Plugin By LARP^^!")
            }else{
               server_cmd("echo Plugin By LARP^^!")
            }
         }
      }
   }
   return PLUGIN_CONTINUE
}
public on_fire(args[]){
 
   new hp
,rx,ry,rz,forigin[3]
   new id = args[0]
   new killer = args[1]
   new tk = args[2]
 
   if
(isburning[id] == 0)
      return PLUGIN_CONTINUE
 
   rx 
= random_num(-30,30)
   ry = random_num(-30,30)
   rz = random_num(-30,30)
   get_user_origin(id,forigin)
 
   
//TE_SPRITE - additive sprite, plays 1 cycle
   message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
   write_byte( 17 )
   write_coord(forigin[0]+rx) // coord, coord, coord (position)
   write_coord(forigin[1]+ry)
   write_coord(forigin[2]+10+rz)
   write_short( burning ) // short (sprite index)
   write_byte( 30 ) // byte (scale in 0.1's)
   write_byte( 200 ) // byte (brightness)
   message_end()
 
   
//Smoke
   message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
   write_byte( 5 )
   write_coord(forigin[0]+(rx*2)) // coord, coord, coord (position)
   write_coord(forigin[1]+(ry*2))
   write_coord(forigin[2]+100+(rz*2))
   write_short( smoke )// short (sprite index)
   write_byte( 60 ) // byte (scale in 0.1's)
   write_byte( 15 ) // byte (framerate)
   message_end()
 
   if
(is_user_alive(id) == 0)
      return PLUGIN_CONTINUE
 
   hp 
= get_user_health(id)
 
   if
((hp - 10) > 0){
      set_user_health(id,hp - 8)
   }
   else {
 
      new namek
[32],namev[32],authida[35],authidv[35],teama[32],teamv[32]
      get_user_name(id,namev,31)
      get_user_name(killer,namek,31)
      get_user_authid(id,authidv,34)
      get_user_authid(killer,authida,34)
      get_user_team(id,teamv,31)
      get_user_team(killer,teama,31)
 
      
//Log the Kill
      //log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"flamethrower^"",
         //namek,get_user_userid(killer),authida,teama,namev,get_user_userid(id),authidv,te
amv)
 
      
//Print message to clients
      //client_print(id,print_chat,"[AMXX] You were killed by %s's Flame Thrower",namek)
      //client_print(killer,print_chat,"[AMXX] You killed %s with your Flame Thrower",namev)
      user_kill(id,0)
 
      if
(tk == 1){
         //client_print(killer,print_center,"You killed a teammate")
         server_cmd("echo Plugin By LARP^^!")
      }
      else{
         server_cmd("echo Plugin By LARP^^!")
      }
 
      
//Kill the victim and block the messages
      set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
      set_msg_block(gmsgScoreInfo,BLOCK_ONCE)
      user_kill(id,1)
 
      
//Makes them stop burning
      isburning[id] = 0
 
      
//Update killers scorboard with new info
      message_begin(MSG_ALL,gmsgScoreInfo)
      write_byte(killer)
      write_short(get_user_frags(killer))
      write_short(get_user_deaths(killer))
      write_short(0)
      write_short(get_user_team(killer))
      message_end()
 
      
//Update victims scoreboard with correct info
      message_begin(MSG_ALL,gmsgScoreInfo)
      write_byte(id)
      write_short(get_user_frags(id))
      write_short(get_user_deaths(id))
      write_short(0)
      write_short(get_user_team(id))
      message_end()
 
      
//Replaced HUD death message
      message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
      write_byte(killer)
      write_byte(id)
      write_byte(0)
      write_string("flamethrower")
      message_end()
 
   
}
   return PLUGIN_CONTINUE
}
 
public fire_scream
(args[]){
   emit_sound(args[0], CHAN_AUTO, "player/headshot2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
   return PLUGIN_CONTINUE
}
 
public stop_firesound
(args[]){
   isburning[args[0]] = 0
   emit_sound
(args[0], CHAN_ITEM, "vox/_period.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
   return PLUGIN_CONTINUE
}
 
public client_connect
(id){
   flame[id]=false
   return PLUGIN_CONTINUE
}
 
public client_disconnect
(id){
   flame[id]=false
   return PLUGIN_CONTINUE
}
 
public round_start
(id) {
   /*for (new k = 1; k <= get_maxplayers(); k++) {
      isburning[k] = 0
      new freeF = get_cvar_num("amx_flamethrower_free")
      if(freeF > 0)
         flame_count[k] = freeF
   }*/
   flame[id]=false
}
public round_end(id) {
   flame[id]=false
}
 
 
 
public plugin_modules
()
{
   require_module("fun")
   require_module("engine")
   require_module("Counter-Strike")
    
}
 
public FM_PreThink
(id)
{
   if(!is_user_alive(id) || !zp_get_user_zombie(id)) return PLUGIN_CONTINUE
   new fl_cost 
= get_cvar_num("amx_fl_hp");
   new armr = get_user_health(id);
   new nzbut = get_user_button(id)
   new ozbut = get_user_oldbutton(id)
   if((zp_get_user_zombie_class(id) == g_zflame) && (nzbut & IN_USE) && !(ozbut & IN_USE))
   //static name[32]
   if(flame[id])
   {   
      if
(armr < fl_cost)
      {
         print_chatColor(id, "\g[ Зомби Чума ]\n \tОгонь закончился - мало Здоровья !\n")
         return PLUGIN_HANDLED
      
}
      set_user_health(id ,armr - fl_cost);
      fire_flamethrower(id);
   }
   else{
      if((nzbut & IN_USE) && (get_entity_flags(id) & FL_ONGROUND))
      flame[id]=false
   
}
   return PLUGIN_CONTINUE
}
 
// Color Chat
stock print_chatColor(const id,const input[], any:...)
{
   new msg[191], players[32], count = 1;
   vformat(msg,190,input,3);
   replace_all(msg,190,"\g","^4");// green
   replace_all(msg,190,"\n","^1");// normal
   replace_all(msg,190,"\t","^3");// team
    
   if 
(id) players[0] = id; else get_players(players,count,"ch");
   for (new i=0;i<count;i++)
      if (is_user_connected(players[i]))
   {
      message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
      write_byte(players[i]);
      write_string(msg);
      message_end();
   }
}

2.zp_zclass_husk
Здесь такая штука.Эсли огонь убивает противника,то убийство бывает зачесляет аж сразу от 6- до 17 фрагов.Но ето так происходит не всегда.
Что здесь не так?
Код: Выделить всё
#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <xs>
 
// Task offsets
enum (+= 100) {
   TASK_BURN
}
 
// IDs inside tasks
#define ID_BURN (taskid - TASK_BURN)
 
#define is_user_valid_alive(%1) (1 <= %1 <= g_maxplayers && is_user_alive(%1))
 
new const zclass_name
[] = { "Отродие" } 
new const zclass_info
[] = { "Огненный Шар" } 
new const zclass_model
[] = { "zombie_zaraza" } 
new const zclass_clawmodel
[] = { "v_cutit_nemesis.mdl" }
const zclass_health = 1700
const zclass_speed 
= 250
const Float
:zclass_gravity = 0.8
const Float
:zclass_knockback = 1.0
 
new g_Husk
new g_trailSpr
new const fire_model
[] = "sprites/3dmflared.spr"
 
// Cooldown hook
new Float:g_iLastFire[33]
 
new cvar_firespeed
, cvar_firecooldown, cvar_firedamage, cvar_fireduration, cvar_fireslowdown, cvar_fireradius, cvar_firesurvivor
new g_smokeSpr
, g_flameSpr, g_exploSpr
new g_burning_duration
[33] // burning task duration
new g_maxplayers
new attacker
 
public plugin_init
()
{
   register_plugin("[ZP] Zombie Class: Zombie Husk", "0.2", "DJHD!") 
    
   cvar_firespeed 
= register_cvar("zp_husk_fire_speed", "700")
   cvar_firecooldown = register_cvar("zp_husk_fire_cooldown", "25.0")
   cvar_firedamage = register_cvar("zp_husk_fire_damage", "2")
   cvar_fireduration = register_cvar("zp_husk_fire_duration", "5")
   cvar_fireslowdown = register_cvar("zp_husk_fire_slowdown", "0.5")
   cvar_fireradius = register_cvar("zp_husk_fire_radius", "120.0")
   cvar_firesurvivor = register_cvar("zp_husk_fire_survivor", "1")
    
   register_forward
(FM_Touch, "fw_Touch")
   register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
   
// HAM Forwards
   RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
   RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
    
   g_maxplayers 
= get_maxplayers()
}
 
 
public plugin_precache
()
{
   g_Husk = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback) 
    
   engfunc
(EngFunc_PrecacheModel, fire_model)
    
   g_trailSpr 
= engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr")
   g_smokeSpr = engfunc(EngFunc_PrecacheModel, "sprites/black_smoke3.spr")
   g_flameSpr = engfunc(EngFunc_PrecacheModel, "sprites/flame.spr")
   g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/zerogxplode.spr")
    
   engfunc
(EngFunc_PrecacheSound, "zombie_plague/husk_pre_fire.wav")
   engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_wind_down.wav")
   engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_fire.wav")
   engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_loop.wav")
   engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_explode.wav")
}
 
public zp_user_infected_post
(id, infector)
{
   if (zp_get_user_zombie_class(id) == g_Husk)
   {
      if(zp_get_user_nemesis(id))
         return
       
      g_iLastFire
[id] = 0.0
       
      print_chatColor
(id, "\g[ Зомби Чума ]\n \tНажмите\n \gR -\n \tвыстрел Огненным Шаром\n") 
   
}
}
 
public fw_PlayerPreThink
(id)
{
   if(!is_user_alive(id))
      return;
    
   static iButton
; iButton = pev(id, pev_button)
   static iOldButton; iOldButton = pev(id, pev_oldbuttons)
    
   if
(zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_Husk) && !zp_get_user_nemesis(id))
   {
      if((iButton & IN_RELOAD) && !(iOldButton & IN_RELOAD))
      {         
         if
(get_gametime() - g_iLastFire[id] < get_pcvar_float(cvar_firecooldown))
         {
            print_chatColor(id, "\g[ Зомби Чума ]\n \tПодождите\n \g%.1f секунд(ы)\n \tчто-бы выстрелить Огненным Шаром\n", get_pcvar_float(cvar_firecooldown)-(get_gametime() - g_iLastFire[id]))
            return;
         }
          
         g_iLastFire
[id] = get_gametime()
          
         message_begin
(MSG_ONE, get_user_msgid("BarTime"), _, id)
         write_byte(1)
         write_byte(0)
         message_end()
          
         emit_sound
(id, CHAN_ITEM, "zombie_plague/husk_pre_fire.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
          
         set_task
(1.0, "MakeFire", id)
      }
       
      if
(iOldButton & IN_RELOAD && !(iButton & IN_RELOAD))
      {
         if(task_exists(id))
         {
            print_chatColor(id, "\g[ Зомби Чума ]\n \tНужно держать клавишу\n \gR\n")
            g_iLastFire[id] = 0.0
            emit_sound
(id, CHAN_ITEM, "zombie_plague/husk_wind_down.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
         }
          
         message_begin
(MSG_ONE, get_user_msgid("BarTime"), _, id)
         write_byte(0)
         write_byte(0)
         message_end()
          
         remove_task
(id)
      }
   }
}
 
// Ham Player Spawn Post Forward
public fw_PlayerSpawn_Post(id)
{
   // Not alive or didn't join a team yet
   if (!is_user_alive(id) || !cs_get_user_team(id))
      return;
    
   
// Remove previous tasks
   remove_task(id+TASK_BURN)
}
 
// Ham Player Killed Forward
public fw_PlayerKilled(victim, attacker, shouldgib)
{
   
   
// Stop burning
   if (!zp_get_user_zombie(victim))
      remove_task(victim+TASK_BURN)
}
 
public client_disconnect
(id)
   remove_task(id+TASK_BURN)
 
public MakeFire
(id)
{
   new Float:Origin[3]
   new Float:vAngle[3]
   new Float:flVelocity[3]
    
   
// Get position from eyes
   get_user_eye_position(id, Origin)
    
   
// Get View Angles
   entity_get_vector(id, EV_VEC_v_angle, vAngle)
    
   new NewEnt 
= create_entity("info_target")
    
   entity_set_string
(NewEnt, EV_SZ_classname, "fireball")
    
   entity_set_model
(NewEnt, fire_model)
    
   entity_set_size
(NewEnt, Float:{ -1.5, -1.5, -1.5 }, Float:{ 1.5, 1.5, 1.5 })
    
   entity_set_origin
(NewEnt, Origin)
    
   
// Set Entity Angles (thanks to Arkshine)
   make_vector(vAngle)
   entity_set_vector(NewEnt, EV_VEC_angles, vAngle)
    
   entity_set_int
(NewEnt, EV_INT_solid, SOLID_BBOX)
    
   entity_set_float
(NewEnt, EV_FL_scale, 0.3)
   entity_set_int(NewEnt, EV_INT_spawnflags, SF_SPRITE_STARTON)
   entity_set_float(NewEnt, EV_FL_framerate, 25.0)
   set_rendering(NewEnt, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255)
    
   entity_set_int
(NewEnt, EV_INT_movetype, MOVETYPE_FLY)
   entity_set_edict(NewEnt, EV_ENT_owner, id)
    
   
// Set Entity Velocity
   velocity_by_aim(id, get_pcvar_num(cvar_firespeed), flVelocity)
   entity_set_vector(NewEnt, EV_VEC_velocity, flVelocity)
    
   message_begin
(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(TE_BEAMFOLLOW) // TE id
   write_short(NewEnt) // entity
   write_short(g_trailSpr) // sprite
   write_byte(5) // life
   write_byte(6) // width
   write_byte(255) // r
   write_byte(0) // g
   write_byte(0) // b
   write_byte(255) // brightness
   message_end()
    
   set_task
(0.2, "effect_fire", NewEnt, _, _, "b") 
    
   emit_sound
(id, CHAN_ITEM, "zombie_plague/husk_fireball_fire.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
   emit_sound(NewEnt, CHAN_ITEM, "zombie_plague/husk_fireball_loop.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
 
public effect_fire
(entity)
{
   if (!pev_valid(entity))
   {
      remove_task(entity)
      return;
   }
    
   
// Get origin
   static Float:originF[3]
   pev(entity, pev_origin, originF)
    
   engfunc
(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
   write_byte(17)
   engfunc(EngFunc_WriteCoord, originF[0])       // x
   engfunc(EngFunc_WriteCoord, originF[1])       // y
   engfunc(EngFunc_WriteCoord, originF[2]+30)       // z
   write_short(g_flameSpr)
   write_byte(5)                   // byte (scale in 0.1's) 188 - era 65
   write_byte(200)                // byte (framerate)
   message_end()
    
   
// Smoke
   engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
   write_byte(5)
   engfunc(EngFunc_WriteCoord, originF[0])    // x
   engfunc(EngFunc_WriteCoord, originF[1])    // y
   engfunc(EngFunc_WriteCoord, originF[2])    // z
   write_short(g_smokeSpr)            // short (sprite index)
   write_byte(13)                // byte (scale in 0.1's)
   write_byte(15)                // byte (framerate)
   message_end()   
    
   
// Colored Aura
   engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
   write_byte(TE_DLIGHT)          // TE id
   engfunc(EngFunc_WriteCoord, originF[0])   // x
   engfunc(EngFunc_WriteCoord, originF[0])   // y
   engfunc(EngFunc_WriteCoord, originF[0])   // z
   write_byte(25)             // radius
   write_byte(255)          // r
   write_byte(128)          // g
   write_byte(0)             // b
   write_byte(2)             // life
   write_byte(3)             // decay rate
   message_end()
}
 
// Touch Forward
public fw_Touch(ent, id)
{
   if (!pev_valid(ent)) 
      return PLUGIN_HANDLED
    
   new class
[32]
   pev(ent, pev_classname, class, charsmax(class))
    
   if
(equal(class, "fireball"))
   {
      attacker = entity_get_edict(ent, EV_ENT_owner)
      husk_touch(ent)
      engfunc(EngFunc_RemoveEntity, ent)
      return PLUGIN_HANDLED
   
}
   return PLUGIN_HANDLED
}
 
public husk_touch
(ent)
{
   if (!pev_valid(ent)) 
      return
;
    
   
// Get origin
   static Float:originF[3]
   pev(ent, pev_origin, originF)
    
   
// Explosion
   engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
   write_byte(TE_EXPLOSION)
   engfunc(EngFunc_WriteCoord, originF[0]) // x
   engfunc(EngFunc_WriteCoord, originF[1]) // y
   engfunc(EngFunc_WriteCoord, originF[2]) // z
   write_short(g_exploSpr)
   write_byte(40)       // byte (scale in 0.1's) 188 - era 65
   write_byte(25)       // byte (framerate)
   write_byte(TE_EXPLFLAG_NOSOUND) // byte flags
   message_end()
    
   emit_sound
(ent, CHAN_ITEM, "zombie_plague/husk_fireball_explode.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    
   
// Collisions
   static victim
   victim 
= -1
    
   while 
((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, get_pcvar_float(cvar_fireradius))) != 0)
   {
      // Only effect alive zombies
      if (!is_user_valid_alive(victim) || zp_get_user_zombie(victim) || !get_pcvar_num(cvar_firesurvivor) && zp_get_user_survivor(victim))
         continue;
       
      message_begin
(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim)
      write_byte(0) // damage save
      write_byte(0) // damage take
      write_long(DMG_BURN) // damage type
      write_coord(0) // x
      write_coord(0) // y
      write_coord(0) // z
      message_end()
       
      g_burning_duration
[victim] += get_pcvar_num(cvar_fireduration) * 5
       
      
// Set burning task on victim if not present
      if (!task_exists(victim+TASK_BURN))
         set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
   }
}
 
// Burning Flames
public burning_flame(taskid)
{
   // Get player origin and flags
   static origin[3], flags
   get_user_origin
(ID_BURN, origin)
   flags = pev(ID_BURN, pev_flags)
    
   
// in water - burning stopped
   if (zp_get_user_zombie(ID_BURN) || (flags & FL_INWATER) || g_burning_duration[ID_BURN] < 1)
   {
      // Smoke sprite
      message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
      write_byte(TE_SMOKE) // TE id
      write_coord(origin[0]) // x
      write_coord(origin[1]) // y
      write_coord(origin[2]-50) // z
      write_short(g_smokeSpr) // sprite
      write_byte(random_num(15, 20)) // scale
      write_byte(random_num(10, 20)) // framerate
      message_end()
       
      
// Task not needed anymore
      remove_task(taskid);
      return;
   }
    
   if 
((pev(ID_BURN, pev_flags) & FL_ONGROUND) && get_pcvar_float(cvar_fireslowdown) > 0.0)
   {
      static Float:velocity[3]
      pev(ID_BURN, pev_velocity, velocity)
      xs_vec_mul_scalar(velocity, get_pcvar_float(cvar_fireslowdown), velocity)
      set_pev(ID_BURN, pev_velocity, velocity)
   }
    
   
// Get player's health
   static health
   health 
= pev(ID_BURN, pev_health)
    
   if 
(health > get_pcvar_float(cvar_firedamage))
      fm_set_user_health(ID_BURN, health - floatround(get_pcvar_float(cvar_firedamage)))
   else
      death_message
(attacker, ID_BURN, "fireball", 1)
    
   
// Flame sprite
   message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
   write_byte(TE_SPRITE) // TE id
   write_coord(origin[0]+random_num(-5, 5)) // x
   write_coord(origin[1]+random_num(-5, 5)) // y
   write_coord(origin[2]+random_num(-10, 10)) // z
   write_short(g_flameSpr) // sprite
   write_byte(random_num(5, 10)) // scale
   write_byte(200) // brightness
   message_end()
    
   
// Decrease burning duration counter
   g_burning_duration[ID_BURN]--
}
 
 
// Death message
public death_message(Killer, Victim, const Weapon [], ScoreBoard)
{
   // Block death msg
   set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
   ExecuteHamB(Ham_Killed, Victim, Killer, 0)
   set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
    
   
// Death
   make_deathmsg(Killer, Victim, 0, Weapon)
    
   
// Update score board
   if (ScoreBoard)
   {
      message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
      write_byte(Killer) // id
      write_short(pev(Killer, pev_frags)) // frags
      write_short(cs_get_user_deaths(Killer)) // deaths
      write_short(0) // class?
      write_short(get_user_team(Killer)) // team
      message_end()
       
      message_begin
(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
      write_byte(Victim) // id
      write_short(pev(Victim, pev_frags)) // frags
      write_short(cs_get_user_deaths(Victim)) // deaths
      write_short(0) // class?
      write_short(get_user_team(Victim)) // team
      message_end()
   }
}
 
/*===============================================================================
=
[Stocks]
================================================================================
=*/
 
// Color Chat
stock print_chatColor(const id,const input[], any:...)
{
   new msg[191], players[32], count = 1;
   vformat(msg,190,input,3);
   replace_all(msg,190,"\g","^4");// green
   replace_all(msg,190,"\n","^1");// normal
   replace_all(msg,190,"\t","^3");// team
    
   if 
(id) players[0] = id; else get_players(players,count,"ch");
   for (new i=0;i<count;i++)
      if (is_user_connected(players[i]))
   {
      message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
      write_byte(players[i]);
      write_string(msg);
      message_end();
   }
}
 
stock get_user_eye_position
(id, Float:flOrigin[3])
{
   static Float:flViewOffs[3]
   entity_get_vector(id, EV_VEC_view_ofs, flViewOffs)
   entity_get_vector(id, EV_VEC_origin, flOrigin)
   xs_vec_add(flOrigin, flViewOffs, flOrigin)
}
 
stock make_vector
(Float:flVec[3])
{
   flVec[0] -= 30.0
   engfunc
(EngFunc_MakeVectors, flVec)
   flVec[0] = -(flVec[0] + 30.0)
}
 
// Set player's health (from fakemeta_util)
stock fm_set_user_health(id, health)
{
   (health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
}
МультиМод CS
Аватара пользователя
MayroN
 
Сообщения: 673
Зарегистрирован: 10 окт 2010, 18:23
Откуда: Украина, г. Белая Церковь
Благодарил (а): 149 раз.
Поблагодарили: 86 раз.
Опыт программирования: Около года
Языки программирования: На которых говорю...

Вернуться в Вопросы по AMXX и его плагинам

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 14