搜索
楼主: 点通粉丝

[AMXX 带源码] 经点通高手重新改过的一些好插件源码

[复制链接]
 楼主| 发表于 2009-1-13 14:40:58 | 显示全部楼层 来自 中国–广东–广州–白云区
有很多..比如什么呢???????
回复

使用道具 举报

发表于 2009-1-13 14:44:14 | 显示全部楼层 来自 中国–广东–韶关
刀杀那个货不对板!!! 刀杀后只是一道闪电,欺骗我感情...
回复

使用道具 举报

 楼主| 发表于 2009-1-13 14:47:42 | 显示全部楼层 来自 中国–广东–广州–白云区
你是版主来的哦..你不会自己改改啊..这么简单..源码都发出来啦
回复

使用道具 举报

 楼主| 发表于 2009-1-13 14:51:31 | 显示全部楼层 来自 中国–广东–广州–白云区
哦我忘啦..那个特效是随机的.一共是五个特效..闪电只是其中一个
版主老大..要点改五使我教你吧..自己改才好完的..知不
回复

使用道具 举报

 楼主| 发表于 2009-1-15 03:02:36 | 显示全部楼层 来自 中国–广东–广州–白云区
  1. ]#include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>

  4. #define PLUGIN "Starting Health"
  5. #define VERSION "1.0"
  6. #define AUTHOR "Sn!ff3r"

  7. new g_pcvarHealth

  8. public plugin_init()
  9. {
  10.         register_plugin(PLUGIN,VERSION,AUTHOR)
  11.        
  12.         g_pcvarHealth = register_cvar("amx_starthp", "200")
  13.        
  14.         RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
  15. }

  16. public player_spawn(id)
  17. {       
  18.         if(is_user_alive(id))
  19.         {
  20.                 new Float:fHealth = get_pcvar_float(g_pcvarHealth)
  21.                 if(fHealth != 100.0)
  22.                 {
  23.                         set_pev(id, pev_health, fHealth)
  24.                 }
  25.         }
  26. }
  27. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  28. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  29. */
复制代码
所有人一出生有200血源码
CVARs :
amx_starthp 200[/code] 34# 点通粉丝
回复

使用道具 举报

 楼主| 发表于 2009-1-15 03:12:13 | 显示全部楼层 来自 中国–广东–广州–白云区

  1. */

  2. #define VERSION        "1.0"

  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <chr_engine>

  6. #define FLAG_SHOWDEALT                1
  7. #define FLAG_SHOWDEALTESP        2
  8. #define FLAG_SHOWTAKEN                4
  9. #define FLAG_SHOWTAKENESP        8

  10. #define ESP_HUD_TIMELEN                0.2

  11. #define TASK_VICTIM                100
  12. #define TASK_ATTACKER                1000

  13. new damage_target[33]
  14. new damage_last[33]

  15. new damaged_target[33]
  16. new damaged_last[33]
  17. new hudchannel1, hudchannel2, mode, timelen

  18. public plugin_init()
  19. {
  20.         register_plugin("Damage Dealt Hud w/ ESP",VERSION,"GHW_Chronic")
  21.         hudchannel1 = register_cvar("espdmg_channel","4")
  22.         hudchannel2 = register_cvar("espdmg_channel2","3")
  23.         mode = register_cvar("espdmg_flags","13")
  24.         timelen = register_cvar("espdmg_timelen","2.0")

  25.         register_event("Damage","damage_hook","b","2>0")

  26.         register_forward(FM_PlayerPreThink,"PreThink_Hook")
  27. }

  28. public damage_hook(id)
  29. {
  30.         if(is_user_alive(id))
  31.         {
  32.                 new target = get_user_attacker(id)
  33.                 if(id!=target && is_user_alive(target))
  34.                 {
  35.                         damage_target[id] = target
  36.                         damage_last[id] = read_data(2)
  37.                         damaged_target[target] = id
  38.                         damaged_last[target] = damage_last[id]

  39.                         remove_task(id + TASK_VICTIM)
  40.                         set_task(get_pcvar_float(timelen),"hud_off",id + TASK_VICTIM)
  41.                         remove_task(target + TASK_ATTACKER)
  42.                         set_task(get_pcvar_float(timelen),"hud_off2",target + TASK_ATTACKER)

  43.                         static colors[2]
  44.                         new mode_cvar = get_pcvar_num(mode)
  45.                         new bool:sameteam
  46.                         if(get_user_team(id)==get_user_team(damage_target[id])) sameteam = true
  47.                         if((mode_cvar & FLAG_SHOWTAKEN) && !(mode_cvar & FLAG_SHOWTAKENESP))
  48.                         {
  49.                                 colors[0] = 255
  50.                                 colors[1] = 255

  51.                                 if(!sameteam)
  52.                                         colors[1] = 0
  53.                                 else
  54.                                         colors[0] = 0

  55.                                 set_hudmessage(colors[0],colors[1],0,0.5,0.5,0,0.0,get_pcvar_float(timelen),0.0,0.0,get_pcvar_num(hudchannel1))
  56.                                 show_hudmessage(id,"%d",damage_last[id])
  57.                         }
  58.                         if((mode_cvar & FLAG_SHOWDEALT) && !(mode_cvar & FLAG_SHOWDEALTESP))
  59.                         {
  60.                                 colors[0] = 255
  61.                                 colors[1] = 255

  62.                                 if(!sameteam)
  63.                                         colors[1] = 0
  64.                                 else
  65.                                         colors[0] = 0

  66.                                 set_hudmessage(0,colors[1],colors[0],0.5,0.4,0,0.0,get_pcvar_float(timelen),0.0,0.0,get_pcvar_num(hudchannel2))
  67.                                 show_hudmessage(id,"%d",damaged_last[id])
  68.                         }
  69.                 }
  70.         }
  71. }

  72. public hud_off(id) damage_target[id - TASK_VICTIM] = 0
  73. public hud_off2(id) damaged_target[id - TASK_ATTACKER] = 0

  74. public PreThink_Hook(id)
  75. {
  76.         if(!is_user_alive(id)) return ;

  77.         static Float:origin[3], Float:hloc[2], colors[3]
  78.         new channel = 0
  79.         new mode_cvar = get_pcvar_num(mode)

  80.         if((mode_cvar & FLAG_SHOWTAKENESP) && damage_target[id])
  81.         {
  82.                 if(is_user_alive(damage_target[id]))
  83.                 {
  84.                         pev(damage_target[id],pev_origin,origin)
  85.                         if(get_hudmessage_locs(id,origin,hloc))
  86.                         {
  87.                                 channel = get_pcvar_num(hudchannel1)
  88.                                 if(channel<1 || channel>4)
  89.                                         channel = 4

  90.                                 colors[0] = 255
  91.                                 colors[1] = 255

  92.                                 if(get_user_team(id)!=get_user_team(damage_target[id]))
  93.                                         colors[1] = 0
  94.                                 else
  95.                                         colors[0] = 0

  96.                                 set_hudmessage(colors[0],colors[1],0,hloc[0],hloc[1],0,0.0,ESP_HUD_TIMELEN,0.0,0.0,channel)
  97.                                 show_hudmessage(id,"%d",damage_last[id])
  98.                         }
  99.                 }
  100.                 else
  101.                         damage_target[id] = 0
  102.         }

  103.         if((mode_cvar & FLAG_SHOWDEALTESP) && damaged_target[id])
  104.         {
  105.                 if(is_user_alive(damaged_target[id]))
  106.                 {
  107.                         pev(damaged_target[id],pev_origin,origin)
  108.                         if(get_hudmessage_locs(id,origin,hloc))
  109.                         {
  110.                                 if(channel>=1 && channel<=4)
  111.                                 {
  112.                                         if(damaged_target[id]==damage_target[id])
  113.                                         {
  114.                                                 hloc[1] -= 0.03
  115.                                         }
  116.                                         channel = get_pcvar_num(hudchannel2)
  117.                                 }
  118.                                 if(channel<1 || channel>4)
  119.                                         channel = 3

  120.                                 colors[0] = 255
  121.                                 colors[1] = 255

  122.                                 if(get_user_team(id)!=get_user_team(damaged_target[id]))
  123.                                         colors[1] = 0
  124.                                 else
  125.                                         colors[0] = 0

  126.                                 set_hudmessage(0,colors[1],colors[0],hloc[0],hloc[1],0,0.0,ESP_HUD_TIMELEN,0.0,0.0,channel)
  127.                                 show_hudmessage(id,"%d",damaged_last[id])
  128.                         }
  129.                 }
  130.                 else
  131.                         damaged_target[id] = 0
  132.         }
  133. }
复制代码
35# 点通粉丝

This plugin is much like bullet_damage(f117bomb) with 1 main difference. This plugin has the ability to make the damage number follow the person who shot you, or configurably the person you just shot.

CVARs:
espdmg_flags - Bitflag of the flags below (add the numbers up to get the value to set this to) (Default: 13)
espdmg_timelen - How long the damage number stays on the screen (Default: 2.0)
espdmg_channel - Primary constant hud channel used by plugin (Default: 4)
espdmg_channel2 - Secondary contant hud channel used by plugin (Default: 3)

Flags:
Code:
FLAG_SHOWDEALT                1        Dmg Dealt appears on screen        (Default)
FLAG_SHOWDEALTESP        2        Dmg Dealt follows target (ESP)
FLAG_SHOWTAKEN                4        Dmg Taken appears on screen        (Default)
FLAG_SHOWTAKENESP        8        Dmg Taken follows shooter (ESP)        (Default)
Requires CHR_Engine Stocks. (So download .amxx file instead of using the "Get Plugin" link.)
回复

使用道具 举报

 楼主| 发表于 2009-1-15 03:41:50 | 显示全部楼层 来自 中国–广东–广州–白云区

  1. */

  2. #define VERSION        "1.2"

  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fun>

  6. public plugin_init()
  7. {
  8.         register_plugin("Disco Mode",VERSION,"GHW_Chronic")
  9.         register_concmd("amx_disco","disco",ADMIN_LEVEL_A," Disco Mode <1/ON 0/OFF> ")
  10. }

  11. public check()
  12. {
  13.         new players[32], num
  14.         get_players(players,num,"ah")
  15.         for(new i=0;i<num;i++)
  16.         {
  17.                 new num1 = random_num(0,255)
  18.                 new num2 = random_num(0,255)
  19.                 new num3 = random_num(0,255)
  20.                 new alpha = random_num(40,65)
  21.                 message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},players[i])
  22.                 write_short(~0)
  23.                 write_short(~0)
  24.                 write_short(1<<12)
  25.                 write_byte(num1)
  26.                 write_byte(num2)
  27.                 write_byte(num3)
  28.                 write_byte(alpha)
  29.                 message_end()
  30.                 set_user_rendering(players[i],kRenderFxGlowShell,num1,num2,num3,kRenderTransAlpha,255)
  31.         }
  32. }

  33. public disco(id,level,cid)
  34. {
  35.         if(!cmd_access(id,level,cid,2))
  36.         {
  37.                 return PLUGIN_HANDLED
  38.         }

  39.         new arg1[32]
  40.         read_argv(1,arg1,31)

  41.         if(equali(arg1,"1") || equali(arg1,"on"))
  42.         {
  43.                 console_print(id,"[AMXX] Disco Mode Activated")
  44.                 client_print(0,print_chat,"[AMXX] W00t W00t. Disco Mode On!")
  45.                 set_task(0.5,"check",1337,"",0,"b")
  46.         }
  47.         else
  48.         {
  49.                 remove_task(1337)

  50.                 console_print(id,"[AMXX] Disco Mode Off")
  51.                 client_print(0,print_chat,"[AMXX] Disco Mode Disabled :'(")

  52.                 set_task(0.2,"unglow")
  53.         }
  54.         return PLUGIN_HANDLED
  55. }

  56. public unglow()
  57. {
  58.         new players[32], num
  59.         get_players(players,num,"h")
  60.         for(new i=0;i<num;i++)
  61.         {
  62.                 message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},players[i])
  63.                 write_short(~0)
  64.                 write_short(~0)
  65.                 write_short(1<<12)
  66.                 write_byte(0)
  67.                 write_byte(0)
  68.                 write_byte(0)
  69.                 write_byte(0)
  70.                 message_end()

  71.                 set_user_rendering(players[i])
  72.         }
  73. }
复制代码
36# 点通粉丝

五彩屏幕变色源码
命令:
amx_disco 1
1/开 0/关
回复

使用道具 举报

发表于 2009-1-15 17:08:25 | 显示全部楼层 来自 中国–福建–泉州
好东东,最好在首页加个总目录介绍
回复

使用道具 举报

 楼主| 发表于 2009-1-16 05:29:01 | 显示全部楼层 来自 中国–广东–广州–白云区
38# wangshengzhen

不用下截的 地球冰炸弹-即O5
过测试cs1.5

  1. /*-------------------
  2.   INCLUDES AND DEFINES
  3. --------------------*/

  4. #include <amxmodx>
  5. #include <fun>
  6. #include <engine>
  7. #include <fakemeta>
  8. #include <cstrike>

  9. new hasFrostNade[33];
  10. new isChilled[33];
  11. new isFrozen[33];

  12. new novaDisplay[33];
  13. new Float:oldSpeed[33];

  14. new glassGibs;
  15. new trailSpr;
  16. new smokeSpr;
  17. new exploSpr;

  18. #define FROST_RADIUS        240.0
  19. #define FROST_R        0
  20. #define FROST_G        206
  21. #define FROST_B        209

  22. #define TASK_REMOVE_CHILL        200
  23. #define TASK_REMOVE_FREEZE        250

  24. /*----------------
  25.   LOADING FUNCTIONS
  26. -----------------*/

  27. // 3, 2, 1: blastoff!
  28. public plugin_init()
  29. {
  30.         register_plugin("FrostNades","0.12b","Avalanche");

  31.         register_cvar("fn_on","1");
  32.         register_cvar("fn_hitself","0");
  33.         register_cvar("fn_los","0");

  34.         register_cvar("fn_maxdamage","50.0");
  35.         register_cvar("fn_mindamage","50.0");

  36.         register_cvar("fn_override","1");
  37.         register_cvar("fn_price","150");

  38.         register_cvar("fn_chill_maxchance","1000");
  39.         register_cvar("fn_chill_minchance","1000");
  40.         register_cvar("fn_chill_duration","4");
  41.         register_cvar("fn_chill_speed","60");

  42.         register_cvar("fn_freeze_maxchance","1000");
  43.         register_cvar("fn_freeze_minchance","1000");
  44.         register_cvar("fn_freeze_duration","5");

  45.         register_clcmd("say /fn","buy_frostnade",-1);
  46.         register_clcmd("say_team /fn","buy_frostnade",-1);
  47.         register_clcmd("say /frostnade","buy_frostnade",-1);
  48.         register_clcmd("say_team /frostnade","buy_frostnade",-1);

  49.         register_event("DeathMsg","event_deathmsg","a");
  50.         register_event("CurWeapon","event_curweapon","b","1=1");
  51.         register_forward(FM_SetModel,"fw_setmodel");
  52.         register_think("grenade","think_grenade");

  53.         register_logevent("event_roundend",2,"0=World triggered","1=Round_End");
  54. }

  55. // get in the cache and be quiet!!
  56. public plugin_precache() {
  57.         precache_model("models/sat_globe.mdl");
  58.         glassGibs = precache_model("models/glassgibs.mdl");

  59.         precache_sound("ambience/wolfhowl01.wav"); // grenade explodes
  60.         precache_sound("warcraft3/impalehit.wav"); // player is frozen
  61.         precache_sound("warcraft3/impalelaunch1.wav"); // frozen wears off
  62.         precache_sound("player/pl_duct2.wav"); // player is chilled

  63.         trailSpr = precache_model("sprites/laserbeam.spr");
  64.         smokeSpr = precache_model("sprites/steam1.spr");
  65.         exploSpr = precache_model("sprites/shockwave.spr");
  66. }

  67. /*------------
  68.   HOOK HANDLERS
  69. -------------*/

  70. // player wants to buy a grenade
  71. public buy_frostnade(id)
  72. {
  73.         if(!get_cvar_num("fn_on"))
  74.                 return PLUGIN_CONTINUE;

  75.         // can't buy while dead
  76.         if(!is_user_alive(id))
  77.                 return PLUGIN_HANDLED;

  78.         // no custom buy needed
  79.         if(get_cvar_num("fn_override"))
  80.                 return PLUGIN_HANDLED;

  81.         // not in a buyzone
  82.         if(!cs_get_user_buyzone(id))
  83.                 return PLUGIN_HANDLED;

  84.         // not enough money
  85.         new money = cs_get_user_money(id);

  86.         if(money < get_cvar_num("fn_price"))
  87.         {
  88.                 client_print(id,print_center,"#Not_Enough_Money");
  89.                 return PLUGIN_HANDLED;
  90.         }

  91.         // already have a frost grenade
  92.         if(hasFrostNade[id])
  93.         {
  94.                 client_print(id,print_center,"#Cstrike_Already_Own_Weapon");
  95.                 return PLUGIN_HANDLED;
  96.         }

  97.         // already have a smoke grenade
  98.         new weapons[32], num, i;
  99.         get_user_weapons(id,weapons,num);

  100.         for(i=0;i<num;i++)
  101.         {
  102.                 if(weapons[i] == CSW_SMOKEGRENADE)
  103.                 {
  104.                         client_print(id,print_center,"You already own a smoke grenade.");
  105.                         return PLUGIN_HANDLED;
  106.                 }
  107.         }

  108.         // gimme gimme
  109.         hasFrostNade[id] = 1;
  110.         give_item(id,"weapon_smokegrenade");
  111.         cs_set_user_money(id,money - get_cvar_num("fn_price"));

  112.         // display icon
  113.         message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
  114.         write_byte(1); // status (0=hide, 1=show, 2=flash)
  115.         write_string("dmg_cold"); // sprite name
  116.         write_byte(FROST_R); // red
  117.         write_byte(FROST_G); // green
  118.         write_byte(FROST_B); // blue
  119.         message_end();

  120.         return PLUGIN_HANDLED;
  121. }

  122. // prethinking
  123. public client_PreThink(id)
  124. {
  125.         if(!get_cvar_num("fn_on"))
  126.                 return;

  127.         // if they are frozen, make sure they don't move at all
  128.         if(isFrozen[id])
  129.         {
  130.                 // stop motion
  131.                 entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0});

  132.                 new button = get_user_button(id), oldbuttons = entity_get_int(id,EV_INT_oldbuttons);
  133.                 new flags = entity_get_int(id,EV_INT_flags);

  134.                 // if are on the ground and about to jump, set the gravity too high to really do so
  135.                 if((button & IN_JUMP) && !(oldbuttons & IN_JUMP) && (flags & FL_ONGROUND))
  136.                         entity_set_float(id,EV_FL_gravity,999999.9); // I CAN'T STAND THE PRESSURE

  137.                 // otherwise, set the gravity so low that they don't fall
  138.                 else
  139.                         entity_set_float(id,EV_FL_gravity,0.000001); // 0.0 doesn't work
  140.         }
  141. }

  142. // someone dies
  143. public event_deathmsg()
  144. {
  145.         if(!get_cvar_num("fn_on"))
  146.                 return;

  147.         new id = read_data(2);

  148.         if(hasFrostNade[id])
  149.         {
  150.                 hasFrostNade[id] = 0;
  151.                 message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
  152.                 write_byte(0); // status (0=hide, 1=show, 2=flash)
  153.                 write_string("dmg_cold"); // sprite name
  154.                 write_byte(FROST_R); // red
  155.                 write_byte(FROST_G); // green
  156.                 write_byte(FROST_B); // blue
  157.                 message_end();
  158.         }

  159.         if(isChilled[id])
  160.                 remove_chill(TASK_REMOVE_CHILL+id);

  161.         if(isFrozen[id])
  162.                 remove_freeze(TASK_REMOVE_FREEZE+id);
  163. }

  164. // a player changes weapons
  165. public event_curweapon(id)
  166. {
  167.         if(!get_cvar_num("fn_on"))
  168.                 return;

  169.         // flash icon if frost grenade is out
  170.         if(hasFrostNade[id] && read_data(2) == CSW_SMOKEGRENADE)
  171.         {
  172.                 message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
  173.                 write_byte(2); // status (0=hide, 1=show, 2=flash)
  174.                 write_string("dmg_cold"); // sprite name
  175.                 write_byte(FROST_R); // red
  176.                 write_byte(FROST_G); // green
  177.                 write_byte(FROST_B); // blue
  178.                 message_end();
  179.         }
  180.         else if(hasFrostNade[id])
  181.         {
  182.                 message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);
  183.                 write_byte(1); // status (0=hide, 1=show, 2=flash)
  184.                 write_string("dmg_cold"); // sprite name
  185.                 write_byte(FROST_R); // red
  186.                 write_byte(FROST_G); // green
  187.                 write_byte(FROST_B); // blue
  188.                 message_end();
  189.         }

  190.         if(isChilled[id])
  191.                 chill_player(id);

  192.         if(isFrozen[id])
  193.                 freeze_player(id);
  194. }

  195. // when a model is set
  196. public fw_setmodel(ent,model[])
  197. {
  198.         if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
  199.                 return FMRES_IGNORED;

  200.         // not a smoke grenade
  201.         if(!equali(model,"models/w_smokegrenade.mdl"))
  202.                 return FMRES_IGNORED;

  203.         // not yet thrown
  204.         if(entity_get_float(ent,EV_FL_gravity) == 0.0)
  205.                 return FMRES_IGNORED;

  206.         new owner = entity_get_edict(ent,EV_ENT_owner);

  207.         // check to see if this isn't a frost grenade
  208.         if(!get_cvar_num("fn_override") && !hasFrostNade[owner])
  209.                 return FMRES_IGNORED;

  210.         // store team in the grenade
  211.         entity_set_int(ent,EV_INT_team,get_user_team(owner));

  212.         // hide icon
  213.         if(hasFrostNade[owner])
  214.         {
  215.                 hasFrostNade[owner] = 0;
  216.                 message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},owner);
  217.                 write_byte(0); // status (0=hide, 1=show, 2=flash)
  218.                 write_string("dmg_cold"); // sprite name
  219.                 write_byte(FROST_R); // red
  220.                 write_byte(FROST_G); // green
  221.                 write_byte(FROST_B); // blue
  222.                 message_end();
  223.         }

  224.         // give it a blue glow and a blue trail
  225.         set_rendering(ent,kRenderFxGlowShell,FROST_R,FROST_G,FROST_B);
  226.         set_beamfollow(ent,10,10,FROST_R,FROST_G,FROST_B,100);

  227.         // hack? flag to remember to track this grenade's think
  228.         entity_set_int(ent,EV_INT_bInDuck,1);

  229.         // track for when it will explode
  230.         set_task(1.6,"grenade_explode",ent);

  231.         return FMRES_IGNORED;
  232. }

  233. // think, grenade. think, damnit!
  234. public think_grenade(ent)
  235. {
  236.         if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
  237.                 return PLUGIN_CONTINUE;

  238.         // hack? not a smoke grenade, or at least not a popular one
  239.         if(!entity_get_int(ent,EV_INT_bInDuck))
  240.                 return PLUGIN_CONTINUE;

  241.         // stop it from exploding
  242.         return PLUGIN_HANDLED;
  243. }

  244. // the round ends
  245. public event_roundend()
  246. {
  247.         new i;
  248.         for(i=1;i<=32;i++)
  249.         {
  250.                 if(isChilled[i])
  251.                         remove_chill(TASK_REMOVE_CHILL+i);

  252.                 if(isFrozen[i])
  253.                         remove_freeze(TASK_REMOVE_FREEZE+i);
  254.         }
  255. }

  256. /*-------------------
  257.   OTHER MAIN FUNCTIONS
  258. --------------------*/

  259. // and boom goes the dynamite
  260. public grenade_explode(ent)
  261. {
  262.         if(get_cvar_num("fn_on") < 1 || !is_valid_ent(ent))
  263.                 return;

  264.         // make the smoke
  265.         new origin[3], Float:originF[3];
  266.         entity_get_vector(ent,EV_VEC_origin,originF);
  267.         FVecIVec(originF,origin);

  268.         message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
  269.         write_byte(5); // TE_SMOKE
  270.         write_coord(origin[0]); // x
  271.         write_coord(origin[1]); // y
  272.         write_coord(origin[2]); // z
  273.         write_short(smokeSpr); // sprite
  274.         write_byte(random_num(35,45)); // scale
  275.         write_byte(5); // framerate
  276.         message_end();

  277.         // debug
  278.         //show_xyz(origin,floatround(FROST_RADIUS));

  279.         // explosion
  280.         create_blast(origin);
  281.         emit_sound(ent,CHAN_WEAPON,"ambience/wolfhowl01.wav",1.0,ATTN_NORM,0,PITCH_NORM);

  282.         // get grenade's owner
  283.         new owner = entity_get_edict(ent,EV_ENT_owner);

  284.         // get grenades team
  285.         new nadeTeam = entity_get_int(ent,EV_INT_team);

  286.         // collisions
  287.         new player;
  288.         while((player = find_ent_in_sphere(player,originF,FROST_RADIUS)) != 0)
  289.         {
  290.                 // not a player, or a dead one
  291.                 if(!is_user_alive(player))
  292.                         continue;
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-1-16 05:30:48 | 显示全部楼层 来自 中国–广东–广州–白云区


  1.                 // don't hit teammates if friendlyfire is off, but don't count self as teammate
  2.                 if((!get_cvar_num("mp_friendlyfire") && nadeTeam == get_user_team(player)) && owner != player)
  3.                         continue;

  4.                 // don't hit self if the cvar is set
  5.                 if(owner == player && !get_cvar_num("fn_hitself"))
  6.                         continue;

  7.                 // if user was frozen this check
  8.                 new wasFrozen;

  9.                 // get this player's origin for calculations
  10.                 new Float:playerOrigin[3];
  11.                 entity_get_vector(player,EV_VEC_origin,playerOrigin);

  12.                 // check for line of sight
  13.                 if(get_cvar_num("fn_los"))
  14.                 {
  15.                         new Float:endPos[3];
  16.                         trace_line(ent,originF,playerOrigin,endPos);

  17.                         // no line of sight (end point not at player's origin)
  18.                         if(endPos[0] != playerOrigin[0] && endPos[1] != playerOrigin[1] && endPos[2] != playerOrigin[2])
  19.                                 continue;
  20.                 }

  21.                 // calculate our odds
  22.                 new Float:chillChance = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_chill_maxchance"),get_cvar_float("fn_chill_minchance"));
  23.                 new Float:freezeChance = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_freeze_maxchance"),get_cvar_float("fn_freeze_minchance"));

  24.                 // deal damage
  25.                 if(get_cvar_float("fn_maxdamage") > 0.0)
  26.                 {
  27.                         new Float:damage = radius_calucation(playerOrigin,originF,FROST_RADIUS,get_cvar_float("fn_maxdamage"),get_cvar_float("fn_mindamage"));

  28.                         // half damage for friendlyfire
  29.                         if(nadeTeam == get_user_team(player))
  30.                                 damage *= 0.5;

  31.                         // see if this will kill player
  32.                         if(floatround(entity_get_float(player,EV_FL_health)) - damage <= 0)
  33.                         {
  34.                                 user_silentkill(player);
  35.                                 make_deathmsg(owner,player,0,"frostgrenade");

  36.                                 // update score
  37.                                 if(nadeTeam == get_user_team(player))
  38.                                 {
  39.                                         set_user_frags(owner,get_user_frags(owner)-1);

  40.                                         if(get_cvar_num("mp_tkpunish"))
  41.                                                 cs_set_user_tked(owner,1,0);
  42.                                 }
  43.                                 else
  44.                                         set_user_frags(owner,get_user_frags(owner)+1);

  45.                                 // update scoreboard
  46.                                 message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
  47.                                 write_byte(owner);
  48.                                 write_short(get_user_frags(owner));
  49.                                 write_short(cs_get_user_deaths(owner));
  50.                                 write_short(0);
  51.                                 write_short(get_user_team(owner));
  52.                                 message_end();

  53.                                 message_begin(MSG_BROADCAST,get_user_msgid("ScoreInfo"));
  54.                                 write_byte(player);
  55.                                 write_short(get_user_frags(player));
  56.                                 write_short(cs_get_user_deaths(player));
  57.                                 write_short(0);
  58.                                 write_short(get_user_team(player));
  59.                                 message_end();

  60.                                 continue;
  61.                         }

  62.                         fakedamage(player,"frostgrenade",damage,3);
  63.                 }

  64.                 // check for freeze
  65.                 if(random_num(1,100) <= floatround(freezeChance) && !isFrozen[player])
  66.                 {
  67.                         wasFrozen = 1;
  68.                         freeze_player(player);
  69.                         isFrozen[player] = 1;

  70.                         emit_sound(player,CHAN_BODY,"warcraft3/impalehit.wav",1.0,ATTN_NORM,0,PITCH_HIGH);
  71.                         set_task(get_cvar_float("fn_freeze_duration"),"remove_freeze",TASK_REMOVE_FREEZE+player);

  72.                         // if they don't already have a frostnova
  73.                         if(!is_valid_ent(novaDisplay[player]))
  74.                         {
  75.                                 // create the entity
  76.                                 new nova = create_entity("info_target");

  77.                                 // give it a size
  78.                                 new Float:maxs[3], Float:mins[3];
  79.                                 maxs = Float:{ 8.0, 8.0, 4.0 };
  80.                                 mins = Float:{ -8.0, -8.0, -4.0 };
  81.                                 entity_set_size(nova,mins,maxs);

  82.                                 // random orientation
  83.                                 new Float:angles[3];
  84.                                 angles[1] = float(random_num(0,359));
  85.                                 entity_set_vector(nova,EV_VEC_angles,angles);

  86.                                 // put it at their feet
  87.                                 new Float:playerMins[3], Float:novaOrigin[3];
  88.                                 entity_get_vector(player,EV_VEC_mins,playerMins);
  89.                                 entity_get_vector(player,EV_VEC_origin,novaOrigin);
  90.                                 novaOrigin[2] += playerMins[2];
  91.                                 entity_set_vector(nova,EV_VEC_origin,novaOrigin);

  92.                                 // mess with the model
  93.                                 entity_set_model(nova,"models/sat_globe.mdl");
  94.                                 entity_set_float(nova,EV_FL_animtime,1.0)
  95.                                 entity_set_float(nova,EV_FL_framerate,1.0)
  96.                                 entity_set_int(nova,EV_INT_sequence,0);
  97.                                 set_rendering(nova,kRenderFxNone,FROST_R,FROST_G,FROST_B,kRenderTransColor,100);

  98.                                 // remember this
  99.                                 novaDisplay[player] = nova;
  100.                         }
  101.                 }

  102.                 // check for chill
  103.                 if(random_num(1,100) <= floatround(chillChance) && !isChilled[player])
  104.                 {
  105.                         chill_player(player);
  106.                         isChilled[player] = 1;

  107.                         // don't play sound if player just got frozen,
  108.                         // reason being it will be overriden and I like the other sound better
  109.                         if(!wasFrozen)
  110.                                 emit_sound(player,CHAN_BODY,"player/pl_duct2.wav",1.0,ATTN_NORM,0,PITCH_LOW);

  111.                         set_task(get_cvar_float("fn_chill_duration"),"remove_chill",TASK_REMOVE_CHILL+player);
  112.                 }
  113.         }

  114.         // get rid of the old grenade
  115.         remove_entity(ent);
  116. }

  117. // apply the effects of being chilled
  118. public chill_player(id)
  119. {
  120.         // don't mess with their speed if they are frozen
  121.         if(isFrozen[id])
  122.                 set_user_maxspeed(id,1.0); // 0.0 doesn't work
  123.         else
  124.         {
  125.                 new speed = floatround(get_user_maxspeed(id) * (get_cvar_float("fn_chill_speed") / 100.0));
  126.                 set_user_maxspeed(id,float(speed));
  127.         }

  128.         // add a blue tint to their screen
  129.         message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id);
  130.         write_short(~0); // duration
  131.         write_short(~0); // hold time
  132.         write_short(0x0004); // flags: FFADE_STAYOUT, ignores the duration, stays faded out until new ScreenFade message received
  133.         write_byte(FROST_R); // red
  134.         write_byte(FROST_G); // green
  135.         write_byte(FROST_B); // blue
  136.         write_byte(100); // alpha
  137.         message_end();

  138.         // make them glow and have a trail
  139.         set_user_rendering(id,kRenderFxGlowShell,FROST_R,FROST_G,FROST_B,kRenderNormal,1);

  140.         // bug fix
  141.         if(!isFrozen[id])
  142.                 set_beamfollow(id,30,8,FROST_R,FROST_G,FROST_B,100);
  143. }

  144. // apply the effects of being frozen
  145. public freeze_player(id)
  146. {
  147.         new Float:speed = get_user_maxspeed(id);

  148.         // remember their old speed for when they get unfrozen,
  149.         // but don't accidentally save their frozen speed
  150.         if(speed > 1.0 && speed != oldSpeed[id])
  151.         {
  152.                 // save their unchilled speed
  153.                 if(isChilled[id])
  154.                 {
  155.                         new speed = floatround(get_user_maxspeed(id) / (get_cvar_float("fn_chill_speed") / 100.0));
  156.                         oldSpeed[id] = float(speed);
  157.                 }
  158.                 else
  159.                         oldSpeed[id] = speed;
  160.         }

  161.         // stop them from moving
  162.         set_user_maxspeed(id,1.0); // 0.0 doesn't work
  163.         entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0});
  164.         entity_set_float(id,EV_FL_gravity,0.000001); // 0.0 doesn't work
  165. }

  166. // a player's chill runs out
  167. public remove_chill(taskid)
  168. {
  169.         remove_task(taskid);
  170.         new id = taskid - TASK_REMOVE_CHILL;

  171.         // no longer chilled
  172.         if(!isChilled[id])
  173.                 return;

  174.         isChilled[id] = 0;

  175.         // only apply effects to this player if they are still connected
  176.         if(is_user_connected(id))
  177.         {
  178.                 // clear screen fade
  179.                 message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id);
  180.                 write_short(0); // duration
  181.                 write_short(0); // hold time
  182.                 write_short(0); // flags
  183.                 write_byte(0); // red
  184.                 write_byte(0); // green
  185.                 write_byte(0); // blue
  186.                 write_byte(0); // alpha
  187.                 message_end();
复制代码
39# 点通粉丝
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表