hi can any jass experts help mi look at this script that i put in my edited dota map for banning global skills like thundergod's wrath and point out if there's any mistakes inside that makes the map lag out?
JASS:
globals
trigger BannedSkillTrigger=null
trigger BannedItemTrigger=null
trigger NoCrowUseDagonTrigger=null
endglobals
function BannedInit takes nothing returns nothing
if SubString(GetEventPlayerChatString(),0,8)=="-banlist" and GetTriggerPlayer()==Player(1) then
call DisplayTimedTextToForce(GetPlayersAll(),60,"|cff00ffffBanned Skills:Thundergod's Wrath, Heat Seeking Missile, March Of The Machines, Wrath Of Nature, Guardian Angel, Borrowed Time, Haunt, Last Word, Global Silence, Hand Of The God|r; |cffff3300Banned Items: Black King Bar, Linken's Sphere.|r")
if IsTriggerEnabled(BannedSkillTrigger)==false or IsTriggerEnabled(BannedSkillTrigger)==false then
call DisplayTimedTextToForce(GetPlayersAll(),2,"|cffff33ffTrigger Enabled!|r")
call EnableTrigger(BannedSkillTrigger)
call EnableTrigger(BannedItemTrigger)
endif
elseif SubString(GetEventPlayerChatString(),0,10)=="-crowdagon" and GetTriggerPlayer()==Player(1) then
call DisplayTimedTextToForce(GetPlayersAll(),60,"|cffff33ffCrow Using Dagon Has Been Banned, Please Abide By The Ban And Don't Use Crow With Dagon, Your Crow Will Be Killed If It Does!|r")
if IsTriggerEnabled(NoCrowUseDagonTrigger)==false then
call DisplayTimedTextToForce(GetPlayersAll(),2,"|cff00ffffTrigger Enabled!|r")
call EnableTrigger(NoCrowUseDagonTrigger)
endif
endif
if SubString(GetEventPlayerChatString(),0,10)=="-cleartext" then
if GetLocalPlayer()==GetTriggerPlayer() then
call ClearTextMessages()
endif
endif
endfunction
function BannedSkillActions takes nothing returns nothing
local unit u=GetTriggerUnit()
if GetAbilityName(GetSpellAbilityId())=="Thundergod's Wrath" or GetAbilityName(GetSpellAbilityId())=="Heat Seeking Missile" or GetAbilityName(GetSpellAbilityId())=="March of the Machines" or GetAbilityName(GetSpellAbilityId())=="Wrath of Nature" or GetAbilityName(GetSpellAbilityId())=="Guardian Angel" then
call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(GetOwningPlayer(u))+" has been killed for using |cff33ff00BANNED SKILLS!|r"))
call KillUnit(u)
elseif GetAbilityName(GetSpellAbilityId())=="Borrowed Time" or GetAbilityName(GetSpellAbilityId())=="Haunt" or GetAbilityName(GetSpellAbilityId())=="Last Word" or GetAbilityName(GetSpellAbilityId())=="Global Silence" or GetAbilityName(GetSpellAbilityId())=="Hand of God" then
call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(GetOwningPlayer(u))+" has been killed for using |cff33ff00BANNED SKILLS!|r"))
call KillUnit(u)
endif
set u=null
endfunction
function BannedItemActions takes nothing returns nothing
local unit u=GetTriggerUnit()
if GetItemName(GetManipulatedItem())=="Linken's Sphere" then
call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(GetOwningPlayer(u))+" tried to buy |cffff00ffLinken's Sphere!|r"))
call SetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)+5175)
call RemoveItem(GetManipulatedItem())
elseif GetItemName(GetManipulatedItem())=="Black King Bar" then
call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(GetOwningPlayer(u))+" tried to buy |cffff00ffBlack King Bar!|r"))
call SetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(u),PLAYER_STATE_RESOURCE_GOLD)+3800)
call RemoveItem(GetManipulatedItem())
endif
set u=null
endfunction
function NoCrowUseDagonActions takes nothing returns nothing
local unit u=GetTriggerUnit()
if SubString(GetItemName(GetManipulatedItem()),0,5)==SubString("Dagon",0,5) and GetUnitName(u)== "Crow" then
call DisplayTextToForce(GetPlayersAll(),(GetPlayerName(GetOwningPlayer(u))+" Tried To Use Dagon With Crow, But His Crow Ended Up Being Killed! |cffff3333Grab The Dropped Dagon Now!|r"))
call KillUnit(u)
endif
set u=null
endfunction
function main takes nothing returns nothing
call TriggerAddAction(BANLIST,function BannedInit)
call TriggerRegisterPlayerChatEvent(BANLIST,Player(1),"-",false)
set BannedSkillTrigger=CreateTrigger()
call DisableTrigger(BannedSkillTrigger)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(7),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(8),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(9),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(10),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(BannedSkillTrigger,Player(11),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerAddAction(BannedSkillTrigger,function BannedSkillActions)
set BannedItemTrigger=CreateTrigger()
call DisableTrigger(BannedSkillTrigger)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(1),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(2),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(3),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(4),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(5),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(7),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(8),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(9),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(10),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(BannedItemTrigger,Player(11),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerAddAction(BannedItemTrigger,function BannedItemActions)
set NoCrowUseDagonTrigger=CreateTrigger()
call DisableTrigger(NoCrowUseDagonTrigger)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(1),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(2),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(3),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(4),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(5),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(7),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(8),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(9),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(10),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerRegisterPlayerUnitEvent(NoCrowUseDagonTrigger,Player(11),EVENT_PLAYER_UNIT_USE_ITEM,null)
call TriggerAddAction(NoCrowUseDagonTrigger,function NoCrowUseDagonActions)
endfunction