Advertisement
Guest User

phoenix147

a guest
Aug 18th, 2009
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.46 KB | None | 0 0
  1. /*
  2. Lineage II Fun Mod for Counter-Strike
  3. by Ph[]3n!X ;)
  4. */
  5.  
  6. #include <lineage2>
  7.  
  8. #define PLUGIN "Lineage II Fun Mod"
  9. #define VERSION "1.0b"
  10. #define AUTHOR "Ph[]3n!X"
  11.  
  12.  
  13.  
  14. public plugin_init() {
  15.     register_plugin(PLUGIN, VERSION, AUTHOR)
  16.    
  17.     //main funcs
  18.     register_clcmd("self","TargetSelf")
  19.     register_clcmd("say .help","ReadHelp")
  20.    
  21.     L2_PrepareServer()
  22.        
  23.     //spells
  24.     register_clcmd("useskill","UseSkill")
  25.        
  26.     // forwards
  27.     RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
  28.     register_forward(FM_CmdStart,"PlayerSpeed",1)
  29.     register_forward(FM_EmitSound, "block_sound")
  30.     RegisterHam(Ham_TakeDamage,"player","KnifeDamage")
  31.     register_forward(FM_Think,"SpellThink")
  32.     register_forward(FM_Touch,"SpellTouch")
  33.    
  34.     //Ads + Info
  35.     StartADs()
  36.    
  37.     //tasks
  38.     ShowCurrentTarget()
  39.    
  40.     //Death Spike
  41.     register_touch("dspike","*","DSTouch")
  42.     register_think("dspike","DSThink")
  43.    
  44.     //Flame Strike
  45.     register_touch("fstrike","*","FSTouch")
  46.     register_think("fstrike","FSThink")
  47.  
  48. }
  49.  
  50. public plugin_precache() {
  51.     precache_model("sprites/flare1.spr")
  52.     precache_model("models/rpgrocket.mdl")
  53.     cylTexture = precache_model("sprites/shockwave.spr")
  54.     TrailTexture = precache_model("sprites/lgtning.spr")
  55.     precache_model(DSTexture)
  56.    
  57.     for(new i=0;i<16;i++) precache_sound(L2Sounds[i]); 
  58. }
  59.  
  60. public client_disconnect(id)
  61. {
  62.     remove_task(id + MANARECHARGE_ID)
  63. }
  64.  
  65. public ManaRecharge(id)
  66. {
  67.     L2_inc_mp(id - MANARECHARGE_ID,20)
  68. }
  69.  
  70. public PlayerSpeed(id)
  71. {
  72.     if(PlayerBC[id][BC_DRYADROOT])
  73.     {
  74.         fm_set_user_maxspeed(id,1.0)
  75.     } else {
  76.         if(PlayerBC[id][BC_WINDWALK])
  77.         {
  78.             fm_set_user_maxspeed(id,320.0)
  79.         }
  80.     }
  81. }
  82.  
  83. public KnifeDamage(victim, idinflictor, idattacker, Float:damage, damagebits)
  84. {
  85.     //waiting
  86. }
  87.  
  88. public TargetSelf(id)
  89. {
  90.     if(Target[id] != id)
  91.     {
  92.         Target[id] = id
  93.         set_hudmessage(255, 255, 255, -1.0, -0.8, 1, 0.0, 1.0)
  94.         show_hudmessage(id, "You have selected yourself")
  95.     }
  96.     return PLUGIN_HANDLED
  97. }
  98.  
  99. public StartADs()
  100. {
  101.     set_task(60.0,"StartADs")
  102.    
  103.     client_print(0,print_chat,"[L2] This server using Lineage II Fun Mod by Ph[]3n!X")
  104.     client_print(0,print_chat,"[L2] If you don't know what to do type '.help' to chat")
  105. }
  106.  
  107. public ShowCurrentTarget()
  108. {
  109.     new players[MAX_PLAYERS],num,i,pname[MAX_PNSTRING]
  110.    
  111.     set_task(0.25,"ShowCurrentTarget")     
  112.     get_players(players,num)
  113.        
  114.     for(i=0;i<32;i++)
  115.     {
  116.         if(is_user_bot(players[i])) return PLUGIN_HANDLED;
  117.         if(is_user_alive(players[i]))
  118.         {
  119.             get_user_name(L2_get_target(players[i]),pname,sizeof(pname))
  120.             if(L2_get_target(players[i]) == NOTARGET) { pname = "No target"; }
  121.             set_hudmessage(0, 255, 0, 0.05, 0.5, 0, 0.0, 0.5)
  122.             ShowSyncHudMsg(players[i],hudObj[0],"Current target: %s^n^nHealth: %d^nMana: %d",pname,get_user_health(players[i]),L2Mana[players[i]])
  123.            
  124.             set_hudmessage(0, 255, 0, 0.05, 0.3, 0, 0.0, 0.5)
  125.             ShowSyncHudMsg(players[i],hudObj[1],"Current buffs:")
  126.            
  127.             for(new Float:x=0.0;x<3.0;x += 1.0)
  128.             {
  129.                 if(PlayerBC[players[i]][floatround(x)])
  130.                 {
  131.                     set_hudmessage(0, 255, 128, 0.05, 0.3 + (0.02 * (x + 2.1)), 0, 0.0, 0.5)
  132.                     ShowSyncHudMsg(players[i],hudObj[3+floatround(x)],"%s",BCName[floatround(x)])
  133.                 }
  134.             }
  135.                        
  136.             new Float:vec[3]
  137.    
  138.             entity_get_vector(L2_get_target(players[i]),EV_VEC_origin,vec)
  139.             if(is_user_alive(L2_get_target(players[i]))) DLight(vec,255,128,1,MSG_ONE,100,255,20,players[i]);
  140.            
  141.         }
  142.     }
  143.     return PLUGIN_CONTINUE
  144. }
  145.  
  146. public UseSkill(id)
  147. {
  148.     new Arg1[3]
  149.     new Float:vec[3],Float:tg_vec[3]
  150.     new tgname[MAX_PNSTRING],kname[MAX_PNSTRING]
  151.     new args[2]
  152.    
  153.     read_argv(1,Arg1,sizeof(Arg1))
  154.     new Spell = str_to_num(Arg1)
  155.    
  156.     get_user_name(id,kname,sizeof(kname))
  157.     get_user_name(L2_get_target(id),tgname,sizeof(tgname))
  158.    
  159.     entity_get_vector(id,EV_VEC_origin,vec)
  160.     entity_get_vector(L2_get_target(id),EV_VEC_origin,tg_vec)
  161.    
  162.     if(L2_get_target(id) == NOTARGET) {
  163.         return PLUGIN_HANDLED
  164.     }
  165.    
  166.     if(!is_user_alive(id) || PlayerBC[id][BC_ANCHOR]) {
  167.         client_print(id,print_chat,"[L2] You can't cast!")
  168.         return PLUGIN_HANDLED
  169.     }
  170.        
  171.     if(!L2_IsPlayerVisible(id,L2_get_target(id))) {
  172.         client_print(id,print_chat,"[L2] Cannot see target!")
  173.         return PLUGIN_HANDLED
  174.     }
  175.    
  176.     if(L2_get_spell_cd(id,Spell) > 0) {
  177.         client_print(id,print_chat,"[L2] You must wait %d %s to re-use!",L2_get_spell_cd(id,Spell),L2_get_spell_cd(id,Spell) == 1 ? "sec." : "secs.")
  178.         return PLUGIN_HANDLED
  179.     }
  180.    
  181.     if(L2_get_mp(id) < L2_get_spell_mc(Spell))
  182.     {
  183.         client_print(id,print_chat,"[L2] Not enough MP!")
  184.         return PLUGIN_HANDLED
  185.     }
  186.    
  187.     if(!is_user_alive(L2_get_target(id))) {
  188.         client_print(id,print_chat,"[L2] Invalid Target!")
  189.         return PLUGIN_HANDLED
  190.     }
  191.    
  192. @@  L2_dec_mp(id,L2_get_spell_mc(Spell))
  193.                
  194. @@  client_print(id,print_chat,"[L2] You use %s",L2_get_spell_name(Spell))
  195.    
  196.     L2_set_spell_cd(id,Spell,L2_get_spell_ru(Spell))
  197.     args[0] = id + L2_get_spell_ti(Spell)
  198.     args[1] = Spell
  199.    
  200.     set_task(1.0,"SpellCooldown",args[0],args,2,"b")
  201.                        
  202.     switch(Spell)
  203.     {
  204.         case SPELL_DEATHSPIKE:
  205.         {                              
  206.             L2_Effects(vec,L2_DEATHSPIKE_K)
  207.             new enttemp = L2_CreateModel(id,"dspike",vec,DSTexture,255,128,10,kRenderFxNone,kRenderTransAdd,SOLID_BBOX,MOVETYPE_BOUNCE,0.5)
  208.             BeamTrail(enttemp,255,1,1,10,15)
  209.             L2_PlaySound(10,id)
  210.            
  211.         }
  212.         case SPELL_FLAMESTRIKE:
  213.         {                              
  214.             L2_Effects(vec,L2_FLAMESTRIKE_K)
  215.             L2_PlaySound(6,id)
  216.             L2_PlaySound(10,id)
  217.             new enttemp = L2_CreateModel(id,"fstrike",vec,DSTexture,200,128,0,kRenderFxNone,kRenderTransAdd,SOLID_BBOX,MOVETYPE_BOUNCE,0.25)
  218.             BeamTrail(enttemp,200,128,1,5,8)
  219.            
  220.         }
  221.         case SPELL_WINDWALK:
  222.         {  
  223.             L2_Effects(vec,L2_HEAL_K)      
  224.             L2_Effects(tg_vec,L2_HEAL_V)
  225.             client_print(Target[id],print_chat,"[L2] Windwalk can be felt.")
  226.             if(task_exists(Target[id])) remove_task(L2_get_target(id) + 10616)
  227.             set_task(180.0,"RemoveWW",L2_get_target(id) + 10616)
  228.             PlayerBC[Target[id]][BC_WINDWALK] = 1
  229.             L2_PlaySound(11,id)
  230.             L2_PlaySound(5,L2_get_target(id))
  231.         }
  232.         case SPELL_BATTLEHEAL:
  233.         {  
  234.             L2_Effects(vec,L2_HEAL_K)      
  235.             L2_Effects(tg_vec,L2_HEAL_V)
  236.             L2_PlaySound(0,id)
  237.             L2_PlaySound(0,L2_get_target(id))
  238.             L2_PlaySound(0,id)
  239.             L2_inc_hp(id,HEAL_HP)          
  240.             client_print(L2_get_target(id),print_chat,"[L2] %d HP has been restored by %s",HEAL_HP, kname)
  241.         }
  242.         case SPELL_ANCHOR:
  243.         {  
  244.             new Rand = random_num(10,17)
  245.             L2_Effects(vec,L2_ANCHOR_K)    
  246.             L2_Effects(tg_vec,L2_ANCHOR_V)
  247.             L2_PlaySound(9,id)
  248.             if(Rand == 13)
  249.             {
  250.                 L2_FreezePlayer(L2_get_target(id),1)
  251.                 client_print(L2_get_target(id),print_chat,"[L2] Anchor can be felt.")
  252.                 set_task(HOLDSPELL_TIME,"UnfreezePlayer",L2_get_target(id) + 10717)
  253.                 set_rendering(L2_get_target(id),kRenderFxGlowShell,255,1,1,kRenderNormal,25)
  254.                 PlayerBC[Target[id]][BC_ANCHOR] = 1
  255.             } else {
  256.                 client_print(id,print_chat,"[L2] Anchor has failed.")
  257.             }
  258.         }
  259.         case SPELL_DRYADROOT:
  260.         {  
  261.             new Rand = random_num(10,13)
  262.             L2_Effects(vec,L2_DRYADROOT_K)     
  263.             L2_Effects(tg_vec,L2_DRYADROOT_V)
  264.             L2_PlaySound(2,id)
  265.             L2_PlaySound(3,L2_get_target(id))
  266.             L2_PlaySound(9,id)
  267.             if(Rand == 12)
  268.             {
  269.                 client_print(L2_get_target(id),print_chat,"[L2] Dryad Root can be felt.")
  270.                 set_task(HOLDSPELL_TIME,"UnRoot",L2_get_target(id) + 10818)
  271.                 set_rendering(L2_get_target(id),kRenderFxGlowShell,1,255,1,kRenderNormal,75)
  272.                 PlayerBC[Target[id]][BC_DRYADROOT] = 1
  273.             } else {
  274.                 client_print(id,print_chat,"[L2] Dryad Root has failed.")
  275.             }
  276.         }
  277.         default: client_print(id,print_chat,"[L2] Invalid Spell Number!")
  278.     }      
  279.     return PLUGIN_HANDLED
  280. }
  281.  
  282. public SpellCooldown(args[])
  283. {
  284.     new cd = L2_get_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1])
  285.     cd -= 1
  286.     L2_set_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1],cd)
  287.    
  288.     if(L2_get_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1]) <= 0)
  289.     {
  290.         remove_task(args[0])
  291.         set_hudmessage(255, 255, 255, -1.0, -0.8, 1, 0.0, 2.0)
  292.         show_hudmessage(args[0] - L2_get_spell_ti(args[1]), "Skill %s is ready to use!",L2_get_spell_name(args[1]))
  293.     }
  294. }
  295.  
  296. public player_spawn(id)
  297. {
  298.     if(!is_user_alive(id)) { return; }
  299.    
  300.     L2_PlayerSpawn(id)
  301.    
  302.     // Mana recharge
  303.    
  304.     for(new i=0;i<6;i++) L2_set_spell_cd(id,i,0);
  305.     for(new i=0;i<3;i++) PlayerBC[id][i] = 0;
  306.     if(task_exists(id + MANARECHARGE_ID)) remove_task(id + MANARECHARGE_ID)
  307.    
  308.     set_task(0.5,"ManaRecharge",id + MANARECHARGE_ID,"",0,"b");
  309. }
  310.  
  311. public DSTouch(ptd, ptr)
  312. {
  313.     if(is_valid_ent(ptd))
  314.     {
  315.         if(is_user_alive(ptr))
  316.         {
  317.             new hp = L2_get_hp(ptr)
  318.             new Float:dmg = random_float(350.0,500.0)
  319.             new pname[32],Float:vec[3]
  320.             new critical = random_num(10,20)
  321.            
  322.             get_user_name(entity_get_edict(ptd,EV_ENT_owner),pname,sizeof(pname))
  323.             entity_get_vector(ptr,EV_VEC_origin,vec)
  324.             L2_Effects(vec,L2_DEATHSPIKE_V)
  325.            
  326.             if(critical == 15)
  327.             {
  328.                 client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] Magic Critical Hit!")
  329.                 L2_PlaySound(8,ptd)
  330.                 dmg *= 3.0;
  331.             }
  332.            
  333.             client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] You hit for %d",floatround(dmg))
  334.             client_print(ptr,print_chat,"[L2] %s hit you for %d",pname,floatround(dmg))
  335.            
  336.             if((hp - dmg)<= 0)
  337.             {
  338.                 user_silentkill(ptr)
  339.                 make_deathmsg(entity_get_edict(ptd,EV_ENT_owner),ptr,0,"gauss")
  340.                 set_user_frags(entity_get_edict(ptd,EV_ENT_owner),get_user_frags(entity_get_edict(ptd,EV_ENT_owner))+5)
  341.             } else {
  342.                 L2_do_dmg(ptr,dmg);
  343.             }
  344.             L2_PlaySound(7,ptd)
  345.         }
  346.         remove_entity(ptd)
  347.     }
  348. }
  349.  
  350. public FSTouch(ptd, ptr)
  351. {
  352.     if(is_valid_ent(ptd))
  353.     {
  354.         if(is_user_alive(ptr))
  355.         {
  356.             new hp = L2_get_hp(ptr)
  357.             new Float:dmg = random_float(550.0,700.0)
  358.             new pname[32],Float:vec[3]
  359.             new critical = random_num(10,20)
  360.            
  361.             get_user_name(entity_get_edict(ptd,EV_ENT_owner),pname,sizeof(pname))
  362.             entity_get_vector(ptr,EV_VEC_origin,vec)
  363.             L2_Effects(vec,L2_FLAMESTRIKE_V)
  364.            
  365.             if(critical == 15)
  366.             {
  367.                 client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] Magic Critical Hit!")
  368.                 L2_PlaySound(8,ptd)
  369.                 dmg *= 3.0;
  370.             }
  371.            
  372.             client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] You hit for %d",floatround(dmg))
  373.             client_print(ptr,print_chat,"[L2] %s hit you for %d",pname,floatround(dmg))
  374.            
  375.             if((hp - dmg)<= 0)
  376.             {
  377.                 user_silentkill(ptr)
  378.                 make_deathmsg(entity_get_edict(ptd,EV_ENT_owner),ptr,0,"gauss")
  379.                 set_user_frags(entity_get_edict(ptd,EV_ENT_owner),get_user_frags(entity_get_edict(ptd,EV_ENT_owner))+5)
  380.             } else {
  381.                 L2_do_dmg(ptr,dmg);
  382.             }
  383.             L2_PlaySound(7,ptd)
  384.         }
  385.         remove_entity(ptd)
  386.     }
  387. }
  388.  
  389. public DSThink(entid)
  390. {
  391.     new otarget,Float:tg_origin[3],Float:entorg[3];
  392.     otarget = entity_get_edict(entid,EV_ENT_owner)
  393.     entity_get_vector(L2_get_target(otarget),EV_VEC_origin,tg_origin)
  394.  
  395.     L2_GuideSpell(entid,tg_origin,800.0)
  396.     entity_get_vector(entid,EV_VEC_origin,entorg)
  397.     Spray(entorg,70,6,1)
  398.    
  399.     if(!is_user_alive(L2_get_target(otarget))) remove_entity(entid);
  400.    
  401.     entity_set_float(entid,EV_FL_nextthink,get_gametime() + 0.05)
  402. }
  403.  
  404. public FSThink(entid)
  405. {
  406.     new otarget,Float:tg_origin[3],Float:entorg[3];
  407.     otarget = entity_get_edict(entid,EV_ENT_owner)
  408.     entity_get_vector(L2_get_target(otarget),EV_VEC_origin,tg_origin)
  409.  
  410.     L2_GuideSpell(entid,tg_origin,800.0)
  411.     entity_get_vector(entid,EV_VEC_origin,entorg)
  412.     Spray(entorg,100,5,1)
  413.    
  414.     if(!is_user_alive(L2_get_target(otarget))) remove_entity(entid);
  415.    
  416.     entity_set_float(entid,EV_FL_nextthink,get_gametime() + 0.05)
  417. }
  418.  
  419. public UnfreezePlayer(id)
  420. {
  421.     L2_FreezePlayer(id - 10717 ,0)
  422.     client_print(id - 10717,print_chat,"[L2] Anchor has worn off")
  423.     set_rendering(id - 10717,kRenderFxNone,255,255,255,kRenderNormal,255)
  424.     PlayerBC[id - 10717][BC_ANCHOR] = 0
  425. }
  426.  
  427. public UnRoot(id)
  428. {
  429.     entity_set_float(id - 10818,EV_FL_maxspeed,260.0)
  430.     client_print(id - 10818,print_chat,"[L2] Dryad Root has worn off")
  431.     set_rendering(id - 10818,kRenderFxNone,255,255,255,kRenderNormal,255)
  432.     PlayerBC[id - 10818][BC_DRYADROOT] = 0
  433. }
  434. public RemoveWW(id)
  435. {
  436.     entity_set_float(id - 10616,EV_FL_maxspeed,260.0)
  437.     client_print(id - 10616,print_chat,"[L2] Windwalk has worn off")
  438.     PlayerBC[id - 10616][BC_WINDWALK] = 0
  439. }
  440.  
  441. public ReadHelp(id)
  442. {
  443.     show_motd(id,"addons\amxmodx\data\l2_help.html","Lineage II Fun Mod Help")
  444.     return PLUGIN_HANDLED
  445. }
  446.  
  447. public block_sound(entity, channel, const sound[])
  448. {
  449.     if (equal(sound, "player/die1.wav") || equal(sound, "player/die2.wav") || equal(sound, "player/die3.wav"))
  450.     {
  451.         L2_PlaySound(12,entity)
  452.         return FMRES_SUPERCEDE
  453.     }
  454.     if (equal(sound, "player/bhit_flesh-1.wav") || equal(sound, "player/bhit_flesh-2.wav") || equal(sound, "player/bhit_flesh-3.wav"))
  455.     {
  456.         new rnd = random_num(13,15)
  457.         L2_PlaySound(rnd,entity)
  458.         return FMRES_SUPERCEDE
  459.     }
  460.     return FMRES_IGNORED
  461. }
  462.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement