Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Lineage II Fun Mod for Counter-Strike
- by Ph[]3n!X ;)
- */
- #include <lineage2>
- #define PLUGIN "Lineage II Fun Mod"
- #define VERSION "1.0b"
- #define AUTHOR "Ph[]3n!X"
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- //main funcs
- register_clcmd("self","TargetSelf")
- register_clcmd("say .help","ReadHelp")
- L2_PrepareServer()
- //spells
- register_clcmd("useskill","UseSkill")
- // forwards
- RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
- register_forward(FM_CmdStart,"PlayerSpeed",1)
- register_forward(FM_EmitSound, "block_sound")
- RegisterHam(Ham_TakeDamage,"player","KnifeDamage")
- register_forward(FM_Think,"SpellThink")
- register_forward(FM_Touch,"SpellTouch")
- //Ads + Info
- StartADs()
- //tasks
- ShowCurrentTarget()
- //Death Spike
- register_touch("dspike","*","DSTouch")
- register_think("dspike","DSThink")
- //Flame Strike
- register_touch("fstrike","*","FSTouch")
- register_think("fstrike","FSThink")
- }
- public plugin_precache() {
- precache_model("sprites/flare1.spr")
- precache_model("models/rpgrocket.mdl")
- cylTexture = precache_model("sprites/shockwave.spr")
- TrailTexture = precache_model("sprites/lgtning.spr")
- precache_model(DSTexture)
- for(new i=0;i<16;i++) precache_sound(L2Sounds[i]);
- }
- public client_disconnect(id)
- {
- remove_task(id + MANARECHARGE_ID)
- }
- public ManaRecharge(id)
- {
- L2_inc_mp(id - MANARECHARGE_ID,20)
- }
- public PlayerSpeed(id)
- {
- if(PlayerBC[id][BC_DRYADROOT])
- {
- fm_set_user_maxspeed(id,1.0)
- } else {
- if(PlayerBC[id][BC_WINDWALK])
- {
- fm_set_user_maxspeed(id,320.0)
- }
- }
- }
- public KnifeDamage(victim, idinflictor, idattacker, Float:damage, damagebits)
- {
- //waiting
- }
- public TargetSelf(id)
- {
- if(Target[id] != id)
- {
- Target[id] = id
- set_hudmessage(255, 255, 255, -1.0, -0.8, 1, 0.0, 1.0)
- show_hudmessage(id, "You have selected yourself")
- }
- return PLUGIN_HANDLED
- }
- public StartADs()
- {
- set_task(60.0,"StartADs")
- client_print(0,print_chat,"[L2] This server using Lineage II Fun Mod by Ph[]3n!X")
- client_print(0,print_chat,"[L2] If you don't know what to do type '.help' to chat")
- }
- public ShowCurrentTarget()
- {
- new players[MAX_PLAYERS],num,i,pname[MAX_PNSTRING]
- set_task(0.25,"ShowCurrentTarget")
- get_players(players,num)
- for(i=0;i<32;i++)
- {
- if(is_user_bot(players[i])) return PLUGIN_HANDLED;
- if(is_user_alive(players[i]))
- {
- get_user_name(L2_get_target(players[i]),pname,sizeof(pname))
- if(L2_get_target(players[i]) == NOTARGET) { pname = "No target"; }
- set_hudmessage(0, 255, 0, 0.05, 0.5, 0, 0.0, 0.5)
- ShowSyncHudMsg(players[i],hudObj[0],"Current target: %s^n^nHealth: %d^nMana: %d",pname,get_user_health(players[i]),L2Mana[players[i]])
- set_hudmessage(0, 255, 0, 0.05, 0.3, 0, 0.0, 0.5)
- ShowSyncHudMsg(players[i],hudObj[1],"Current buffs:")
- for(new Float:x=0.0;x<3.0;x += 1.0)
- {
- if(PlayerBC[players[i]][floatround(x)])
- {
- set_hudmessage(0, 255, 128, 0.05, 0.3 + (0.02 * (x + 2.1)), 0, 0.0, 0.5)
- ShowSyncHudMsg(players[i],hudObj[3+floatround(x)],"%s",BCName[floatround(x)])
- }
- }
- new Float:vec[3]
- entity_get_vector(L2_get_target(players[i]),EV_VEC_origin,vec)
- if(is_user_alive(L2_get_target(players[i]))) DLight(vec,255,128,1,MSG_ONE,100,255,20,players[i]);
- }
- }
- return PLUGIN_CONTINUE
- }
- public UseSkill(id)
- {
- new Arg1[3]
- new Float:vec[3],Float:tg_vec[3]
- new tgname[MAX_PNSTRING],kname[MAX_PNSTRING]
- new args[2]
- read_argv(1,Arg1,sizeof(Arg1))
- new Spell = str_to_num(Arg1)
- get_user_name(id,kname,sizeof(kname))
- get_user_name(L2_get_target(id),tgname,sizeof(tgname))
- entity_get_vector(id,EV_VEC_origin,vec)
- entity_get_vector(L2_get_target(id),EV_VEC_origin,tg_vec)
- if(L2_get_target(id) == NOTARGET) {
- return PLUGIN_HANDLED
- }
- if(!is_user_alive(id) || PlayerBC[id][BC_ANCHOR]) {
- client_print(id,print_chat,"[L2] You can't cast!")
- return PLUGIN_HANDLED
- }
- if(!L2_IsPlayerVisible(id,L2_get_target(id))) {
- client_print(id,print_chat,"[L2] Cannot see target!")
- return PLUGIN_HANDLED
- }
- if(L2_get_spell_cd(id,Spell) > 0) {
- 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.")
- return PLUGIN_HANDLED
- }
- if(L2_get_mp(id) < L2_get_spell_mc(Spell))
- {
- client_print(id,print_chat,"[L2] Not enough MP!")
- return PLUGIN_HANDLED
- }
- if(!is_user_alive(L2_get_target(id))) {
- client_print(id,print_chat,"[L2] Invalid Target!")
- return PLUGIN_HANDLED
- }
- @@ L2_dec_mp(id,L2_get_spell_mc(Spell))
- @@ client_print(id,print_chat,"[L2] You use %s",L2_get_spell_name(Spell))
- L2_set_spell_cd(id,Spell,L2_get_spell_ru(Spell))
- args[0] = id + L2_get_spell_ti(Spell)
- args[1] = Spell
- set_task(1.0,"SpellCooldown",args[0],args,2,"b")
- switch(Spell)
- {
- case SPELL_DEATHSPIKE:
- {
- L2_Effects(vec,L2_DEATHSPIKE_K)
- new enttemp = L2_CreateModel(id,"dspike",vec,DSTexture,255,128,10,kRenderFxNone,kRenderTransAdd,SOLID_BBOX,MOVETYPE_BOUNCE,0.5)
- BeamTrail(enttemp,255,1,1,10,15)
- L2_PlaySound(10,id)
- }
- case SPELL_FLAMESTRIKE:
- {
- L2_Effects(vec,L2_FLAMESTRIKE_K)
- L2_PlaySound(6,id)
- L2_PlaySound(10,id)
- new enttemp = L2_CreateModel(id,"fstrike",vec,DSTexture,200,128,0,kRenderFxNone,kRenderTransAdd,SOLID_BBOX,MOVETYPE_BOUNCE,0.25)
- BeamTrail(enttemp,200,128,1,5,8)
- }
- case SPELL_WINDWALK:
- {
- L2_Effects(vec,L2_HEAL_K)
- L2_Effects(tg_vec,L2_HEAL_V)
- client_print(Target[id],print_chat,"[L2] Windwalk can be felt.")
- if(task_exists(Target[id])) remove_task(L2_get_target(id) + 10616)
- set_task(180.0,"RemoveWW",L2_get_target(id) + 10616)
- PlayerBC[Target[id]][BC_WINDWALK] = 1
- L2_PlaySound(11,id)
- L2_PlaySound(5,L2_get_target(id))
- }
- case SPELL_BATTLEHEAL:
- {
- L2_Effects(vec,L2_HEAL_K)
- L2_Effects(tg_vec,L2_HEAL_V)
- L2_PlaySound(0,id)
- L2_PlaySound(0,L2_get_target(id))
- L2_PlaySound(0,id)
- L2_inc_hp(id,HEAL_HP)
- client_print(L2_get_target(id),print_chat,"[L2] %d HP has been restored by %s",HEAL_HP, kname)
- }
- case SPELL_ANCHOR:
- {
- new Rand = random_num(10,17)
- L2_Effects(vec,L2_ANCHOR_K)
- L2_Effects(tg_vec,L2_ANCHOR_V)
- L2_PlaySound(9,id)
- if(Rand == 13)
- {
- L2_FreezePlayer(L2_get_target(id),1)
- client_print(L2_get_target(id),print_chat,"[L2] Anchor can be felt.")
- set_task(HOLDSPELL_TIME,"UnfreezePlayer",L2_get_target(id) + 10717)
- set_rendering(L2_get_target(id),kRenderFxGlowShell,255,1,1,kRenderNormal,25)
- PlayerBC[Target[id]][BC_ANCHOR] = 1
- } else {
- client_print(id,print_chat,"[L2] Anchor has failed.")
- }
- }
- case SPELL_DRYADROOT:
- {
- new Rand = random_num(10,13)
- L2_Effects(vec,L2_DRYADROOT_K)
- L2_Effects(tg_vec,L2_DRYADROOT_V)
- L2_PlaySound(2,id)
- L2_PlaySound(3,L2_get_target(id))
- L2_PlaySound(9,id)
- if(Rand == 12)
- {
- client_print(L2_get_target(id),print_chat,"[L2] Dryad Root can be felt.")
- set_task(HOLDSPELL_TIME,"UnRoot",L2_get_target(id) + 10818)
- set_rendering(L2_get_target(id),kRenderFxGlowShell,1,255,1,kRenderNormal,75)
- PlayerBC[Target[id]][BC_DRYADROOT] = 1
- } else {
- client_print(id,print_chat,"[L2] Dryad Root has failed.")
- }
- }
- default: client_print(id,print_chat,"[L2] Invalid Spell Number!")
- }
- return PLUGIN_HANDLED
- }
- public SpellCooldown(args[])
- {
- new cd = L2_get_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1])
- cd -= 1
- L2_set_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1],cd)
- if(L2_get_spell_cd(args[0] - L2_get_spell_ti(args[1]),args[1]) <= 0)
- {
- remove_task(args[0])
- set_hudmessage(255, 255, 255, -1.0, -0.8, 1, 0.0, 2.0)
- show_hudmessage(args[0] - L2_get_spell_ti(args[1]), "Skill %s is ready to use!",L2_get_spell_name(args[1]))
- }
- }
- public player_spawn(id)
- {
- if(!is_user_alive(id)) { return; }
- L2_PlayerSpawn(id)
- // Mana recharge
- for(new i=0;i<6;i++) L2_set_spell_cd(id,i,0);
- for(new i=0;i<3;i++) PlayerBC[id][i] = 0;
- if(task_exists(id + MANARECHARGE_ID)) remove_task(id + MANARECHARGE_ID)
- set_task(0.5,"ManaRecharge",id + MANARECHARGE_ID,"",0,"b");
- }
- public DSTouch(ptd, ptr)
- {
- if(is_valid_ent(ptd))
- {
- if(is_user_alive(ptr))
- {
- new hp = L2_get_hp(ptr)
- new Float:dmg = random_float(350.0,500.0)
- new pname[32],Float:vec[3]
- new critical = random_num(10,20)
- get_user_name(entity_get_edict(ptd,EV_ENT_owner),pname,sizeof(pname))
- entity_get_vector(ptr,EV_VEC_origin,vec)
- L2_Effects(vec,L2_DEATHSPIKE_V)
- if(critical == 15)
- {
- client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] Magic Critical Hit!")
- L2_PlaySound(8,ptd)
- dmg *= 3.0;
- }
- client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] You hit for %d",floatround(dmg))
- client_print(ptr,print_chat,"[L2] %s hit you for %d",pname,floatround(dmg))
- if((hp - dmg)<= 0)
- {
- user_silentkill(ptr)
- make_deathmsg(entity_get_edict(ptd,EV_ENT_owner),ptr,0,"gauss")
- set_user_frags(entity_get_edict(ptd,EV_ENT_owner),get_user_frags(entity_get_edict(ptd,EV_ENT_owner))+5)
- } else {
- L2_do_dmg(ptr,dmg);
- }
- L2_PlaySound(7,ptd)
- }
- remove_entity(ptd)
- }
- }
- public FSTouch(ptd, ptr)
- {
- if(is_valid_ent(ptd))
- {
- if(is_user_alive(ptr))
- {
- new hp = L2_get_hp(ptr)
- new Float:dmg = random_float(550.0,700.0)
- new pname[32],Float:vec[3]
- new critical = random_num(10,20)
- get_user_name(entity_get_edict(ptd,EV_ENT_owner),pname,sizeof(pname))
- entity_get_vector(ptr,EV_VEC_origin,vec)
- L2_Effects(vec,L2_FLAMESTRIKE_V)
- if(critical == 15)
- {
- client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] Magic Critical Hit!")
- L2_PlaySound(8,ptd)
- dmg *= 3.0;
- }
- client_print(entity_get_edict(ptd,EV_ENT_owner),print_chat,"[L2] You hit for %d",floatround(dmg))
- client_print(ptr,print_chat,"[L2] %s hit you for %d",pname,floatround(dmg))
- if((hp - dmg)<= 0)
- {
- user_silentkill(ptr)
- make_deathmsg(entity_get_edict(ptd,EV_ENT_owner),ptr,0,"gauss")
- set_user_frags(entity_get_edict(ptd,EV_ENT_owner),get_user_frags(entity_get_edict(ptd,EV_ENT_owner))+5)
- } else {
- L2_do_dmg(ptr,dmg);
- }
- L2_PlaySound(7,ptd)
- }
- remove_entity(ptd)
- }
- }
- public DSThink(entid)
- {
- new otarget,Float:tg_origin[3],Float:entorg[3];
- otarget = entity_get_edict(entid,EV_ENT_owner)
- entity_get_vector(L2_get_target(otarget),EV_VEC_origin,tg_origin)
- L2_GuideSpell(entid,tg_origin,800.0)
- entity_get_vector(entid,EV_VEC_origin,entorg)
- Spray(entorg,70,6,1)
- if(!is_user_alive(L2_get_target(otarget))) remove_entity(entid);
- entity_set_float(entid,EV_FL_nextthink,get_gametime() + 0.05)
- }
- public FSThink(entid)
- {
- new otarget,Float:tg_origin[3],Float:entorg[3];
- otarget = entity_get_edict(entid,EV_ENT_owner)
- entity_get_vector(L2_get_target(otarget),EV_VEC_origin,tg_origin)
- L2_GuideSpell(entid,tg_origin,800.0)
- entity_get_vector(entid,EV_VEC_origin,entorg)
- Spray(entorg,100,5,1)
- if(!is_user_alive(L2_get_target(otarget))) remove_entity(entid);
- entity_set_float(entid,EV_FL_nextthink,get_gametime() + 0.05)
- }
- public UnfreezePlayer(id)
- {
- L2_FreezePlayer(id - 10717 ,0)
- client_print(id - 10717,print_chat,"[L2] Anchor has worn off")
- set_rendering(id - 10717,kRenderFxNone,255,255,255,kRenderNormal,255)
- PlayerBC[id - 10717][BC_ANCHOR] = 0
- }
- public UnRoot(id)
- {
- entity_set_float(id - 10818,EV_FL_maxspeed,260.0)
- client_print(id - 10818,print_chat,"[L2] Dryad Root has worn off")
- set_rendering(id - 10818,kRenderFxNone,255,255,255,kRenderNormal,255)
- PlayerBC[id - 10818][BC_DRYADROOT] = 0
- }
- public RemoveWW(id)
- {
- entity_set_float(id - 10616,EV_FL_maxspeed,260.0)
- client_print(id - 10616,print_chat,"[L2] Windwalk has worn off")
- PlayerBC[id - 10616][BC_WINDWALK] = 0
- }
- public ReadHelp(id)
- {
- show_motd(id,"addons\amxmodx\data\l2_help.html","Lineage II Fun Mod Help")
- return PLUGIN_HANDLED
- }
- public block_sound(entity, channel, const sound[])
- {
- if (equal(sound, "player/die1.wav") || equal(sound, "player/die2.wav") || equal(sound, "player/die3.wav"))
- {
- L2_PlaySound(12,entity)
- return FMRES_SUPERCEDE
- }
- if (equal(sound, "player/bhit_flesh-1.wav") || equal(sound, "player/bhit_flesh-2.wav") || equal(sound, "player/bhit_flesh-3.wav"))
- {
- new rnd = random_num(13,15)
- L2_PlaySound(rnd,entity)
- return FMRES_SUPERCEDE
- }
- return FMRES_IGNORED
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement