Few script errors menu

User Tag List

Results 1 to 3 of 3
  1. #1
    rekbu's Avatar Member
    Reputation
    2
    Join Date
    Jul 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Few script errors

    I cant use this scripts in my server,for somme i am getting errors but for somme npc just not work!

    Here thay are:
    Code:
    --[[=========================================
     _     _    _
    | |   | |  | |  /\                  /\
    | |   | |  | | /  \   _ __  _ __   /  \   _ __ ___
    | |   | |  | |/ /\ \ | '_ \| '_ \ / /\ \ | '__/ __|
    | |___| |__| / ____ \| |_) | |_) / ____ \| | | (__
    |______\____/_/    \_\ .__/| .__/_/    \_\_|  \___|
      Scripting Project  | |   | | Improved LUA Engine
                         |_|   |_|
       SVN: http://svn.burning-azzinoth.de/LUAppArc
       LOG: http://burning-azzinoth.de/arcemu/new/frontend/?t=2
       ----------------------
       WoW Football
       Code by Kenuvis
       Version 0.3+
    ========================================]]--
    
    local Conf = {}
    -- Wieviele Spieler brauch es pro Team mindestens, damit das Spiel starten kann?
    -- Howmany player each team is essential for starting the game?
    Conf.MinPlayer = 0
    
    -- Wieviele Tore braucht man, ehe man gewonnen hat?
    -- Howmany goals is essential to win the game?
    Conf.Goals = 5
    
    -- NPC ID des Balles
    -- NPC ID of the Ball
    Conf.BallID = 198768
    
    -- NPC ID des Masters
    -- NPC ID of the Master
    Conf.MasterID = 198767
    
    -- Eckpunkte des Feldes (60[x] x 30[y])
    -- corners of the field (60[x] x 30[y])
    Conf.Ecke_A = {x = -5121, y = 1088}
    Conf.Ecke_B = {x = -5061, y = 1118}
    
    -- Falls ihr Luapparc nicht verwendet, tragt bitte hier die MapId ein, wo euer Feld steht
    -- if you dont use Luapparc, insert the MapId of your football field here
    Conf.MapId = 1
    
    -- Rezzlocations für die Teams
    -- Rezzlocations for the Teams
    Conf.Rezz_A = {x = -5100.198242, y = 1085.230103, z = 386}
    Conf.Rezz_B = {x = -5080.903320, y = 1084.947266, z = 386}
    
    -- Belohnung für die Gewinner
    -- Reward for the Winner
    Conf.WinRewardItem = 90001
    Conf.WinRewardCount = 3
    
    -- Trostpreis für die Verlierer
    -- Reward for the Looser
    Conf.LooseRewardItem = 90001
    Conf.LooseRewardCount = 1
    
    -- Name für Team A und B
    -- Name of Team A and B
    Conf.Team_A_Name = "A"
    Conf.Team_B_Name = "B"
    
    -- de = Deutsch; en = english
    Conf.Language = "de"
    
    Conf.Lang = {
    	de = {
    			Run_already = "Du kannst dir das Spiel gerne anschauen. Nehm Platz!",
    			Wait_Status = " Team %s Warteschlange: %s \n Team %s Warteschlange: %s",
    			Join_Team = "Zu Team %s anmelden",
    			Join_Random_Team = "Zu Zufallsteam anmelden",
    			Leave_Team = "Abmelden",
    			Second_To_Wait = "Noch %s Sekunden",
    			Mod_Goal_1 = "Team %s %s : %s Team %s",
    			Mod_End_1 = "Das Spiel ist aus, aus .. Team %s hat gewonnen!"},
    	en = { 
    			Run_already = "The game is already running. Please, sit down and watch the game.",
    			Wait_Status = " Team %s player: %s \n Team %s player: %s",
    			Join_Team = "Join Team %s ",
    			Join_Random_Team = "Join random Team",
    			Leave_Team = "Leave",
    			Second_To_Wait = "%s seconds",
    			Mod_Goal_1 = "Team %s %s : %s Team %s",
    			Mod_End_1 = "The game is over! Team %s win the game!"}
    		}
    
    
    ----------------------------------------
    ----- Ab hier nichts weiter ändern -----
    ----- Nothing change after this    -----
    ----------------------------------------
    
    print ("############################################")
    print ("# Football Event v0.3")
    print ("# Code by Kenuvis")
    print ("# LUAppArc Scripting Project")
    
    if LSL_Build then
    	if LSL_Check(51, "# Error: ") == true then 
    		
    		if not _G.GetLUAEngine then
    			Conf.Luapparc = false
    			print("# Error: LUAppArc Engine dont found.")
    			print("# You might get some errors, because you not using LUApparc")
    		else
    			Conf.Luapparc = true
    			print ("# LUAppArc Engine found")
    		end
    	
    		RegisterUnitEvent(Conf.BallID,18,"Football_On_Spawn")
    		
    		RegisterUnitGossipEvent(Conf.MasterID, 1, "Football_On_Gossip")
    		RegisterUnitGossipEvent(Conf.MasterID, 2, "Football_On_Select")
    		
    	    print ("# LSL Engine found")
    	    
    	end	
    else
    	print("# Error: LSL dont found.")
    	print("# You need the LSL, which can download on the SVN of LUAppArc.")
    end 
    
    print ("############################################")
    
    local Football = {
    		Player = {},
    		Team_A = {},
    		Team_B = {},
    		Last_Player = 0,
    		Ecke_A = Conf.Ecke_A,
    		Ecke_B = Conf.Ecke_B,
    		Points_A = 0,
    		Points_B = 0,
    		Leader = 0,
    		Ball = 0,
    		Run = false,
    		Rezz = {}
    				}
    				
    -- Local functions --
    
    local function GetMapId(Unit)
    	if Conf.Luapparc == true then
    		return Unit:GetMapId()
    	else
    		return Conf.MapId
    	end
    end
    
    local function Football_Clear_Offline(_table)
    	for i,ply in pairs(_table) do
    		while not ply:IsInWorld() do
    			table.remove(_table, i)
    			ply = _table[i]
    			if ply == nil then break end
    		end
    	end
    
    	return _table
    end
    
    local function Football_Check_Movement(x, y, addx, addy)
    
    	local multix = 1
    	local multiy = 1
    	
    	if x + addx > Football.Ecke_B.x then
    		multix = addx/(x - Football.Ecke_B.x)
    	elseif x + addx < Football.Ecke_A.x then
    		multix = addx/(Football.Ecke_A.x - x)
    	end
    
    	if y + addy > Football.Ecke_B.y then
    		multiy = addy/(Football.Ecke_B.y - y)
    	elseif y + addy < Football.Ecke_A.y then
    		multiy = addy/(y - Football.Ecke_A.y)
    	end
    
    	local multi = math.max(math.abs(multix), math.abs(multiy))
    
    	return addx/multi, addy/multi
    
    end
    
    local function Football_Event(Event, Addition)
    
    	if Event == "goal" then
    	    Football.Leader:SendChatMessage(14, 0, string.format(Conf.Lang[Conf.Language].Mod_Goal_1, Conf.Team_A_Name, Football.Points_A, Football.Points_B, Conf.Team_B_Name))
    
    	    --Torschütze Football.Last_Player
    
            if Football.Points_A >= Conf.Goals then
                Football_Event("end", Addition)
                return
    		elseif Football.Points_B >= Conf.Goals then
                Football_Event("end", Addition)
                return
    		end
    		
    		Football_Event("unreg_ball")
    		Football_Event("spawn_ball", Football.Leader)
    		Football_Event("spawn_player", Football.Leader)
    		Football_Event("firework", "blau")
    		
    	elseif Event == "player_change" then
    		if math.random() > 0.7 then
    			Football.Leader:SpawnGameObject(185466, Addition:GetX(), Addition:GetY(), Addition:GetZ(), 0, 10000)
    		end		    	
    	elseif Event == "end" then
    	    Football.Leader:SendChatMessage(14, 0, string.format(Conf.Lang[Conf.Language].Mod_End_1, Addition))
      		Football_Event("unreg_ball")
            Football.Player = {}
            
            if Addition == Conf.Team_A_Name then
            	Win = Football.Team_A
            	Loose = Football.Team_B
            else
            	Win = Football.Team_B
            	Loose = Football.Team_A
            end
    		
    		for _,ply in pairs(Win) do
            	if ply:IsInWorld() then
            		ply:AddItem(Conf.WinRewardItem, Conf.WinRewardCount)
            	end
            end
            for _,ply in pairs(Loose) do
            	if ply:IsInWorld() then
            		ply:AddItem(Conf.LooseRewardItem, Conf.LooseRewardCount)
            	end
            end
            
    		Football.Team_A = {}
    		Football.Team_B = {}
    		Football.Last_Player = 0
    		Football.Points_A = 0
    		Football.Points_B = 0
    		Football.Ball = 0
    		Football.Run = false
    	elseif Event == "start" then
    	
    		Football.Run = true
      		Football_Event("spawn_ball", Addition)
    		Football.Leader = Addition
    		Football_Event("spawn_player", Addition)
    		
    		Football_Event("firework", "blau")
    	elseif Event == "unreg_ball" then
    		if Football.Ball then
    			Football.Ball:RemoveEvents()
    			Football.Ball:Despawn(1,0)
    		end
    	elseif Event == "spawn_ball" then
    	
    	    local x = Football.Ecke_A.x + 30
    	    local y = Football.Ecke_A.y + 15
    	    local z = Addition:GetZ()+3
    	
    	    Football.Ball = Addition:SpawnCreature(Conf.BallID, x, y, z, 0, 35, 600000)
    	elseif Event == "spawn_player" then
    	
    	    local x = Football.Ecke_A.x
    	    local y = Football.Ecke_A.y
    	    local z = Addition:GetZ()+5
    	    local mapid = GetMapId(Addition)
    			    
    		for _,ply in pairs(Football.Team_A) do
    			if ply:IsInWorld() then
    			    ply:Teleport(mapid, x, y+15+math.random(-5,5), z)
    			end
    		end
    		
    		for _,ply in pairs(Football.Team_B) do
    			if ply:IsInWorld() then
    			    ply:Teleport(mapid, x+60, y+15+math.random(-5,5), z)
    			end
    		end
    	elseif Event == "firework" then
    		for a = Football.Ecke_A.x, Football.Ecke_B.x, 2 do
    			Football.Leader:SpawnGameObject(181852, a, Football.Ecke_B.y, Football.Leader:GetZ(), 1, 5000)
                Football.Leader:SpawnGameObject(181852, a, Football.Ecke_A.y, Football.Leader:GetZ(), 1, 5000)
            end
            
            for a = Football.Ecke_A.y, Football.Ecke_B.y, 2 do
    			Football.Leader:SpawnGameObject(181852, Football.Ecke_A.x, a, Football.Leader:GetZ(), 1, 5000)
                Football.Leader:SpawnGameObject(181852, Football.Ecke_B.x, a, Football.Leader:GetZ(), 1, 5000)
            end
        else
        	print("behandeltes Event - "..Event)
        end
        
    end
    
    local function Football_Start_Check(Unit)
    	if table.getn(Football.Team_A) >= Conf.MinPlayer and table.getn(Football.Team_B) >= Conf.MinPlayer then
    	    Football_Event("start", Unit)
    	end
    end
    
    -- Register --
    
    function Football_On_Gossip(Unit,_,Player)
    
    	if Football.Run == true then
    		Unit:SendChatMessage(12, 0, Conf.Lang[Conf.Language].Run_already)
    		return 
    	end
    
    	local Text = string.format(Conf.Lang[Conf.Language].Wait_Status, Conf.Team_A_Name, table.getn(Football.Team_A), Conf.Team_B_Name, table.getn(Football.Team_B))
    
    	if table.find(Football.Player, Player) then
    	    entry.AddGossipMenu(Unit, Player, {Conf.Lang[Conf.Language].Leave_Team, 1, Text, 2})
    	else
    	    entry.AddGossipMenu(Unit, Player, {string.format(Conf.Lang[Conf.Language].Join_Team, Conf.Team_A_Name), 3,
    										   string.format(Conf.Lang[Conf.Language].Join_Team, Conf.Team_B_Name), 4,
    										   Conf.Lang[Conf.Language].Join_Random_Team, 5,
    										   Text, 2})
    	end
    	
    end
    
    function Football_On_Select(Unit,_,Player,_,id)
    
    	if Football.Run == true then
    		Unit:SendChatMessage(12, 0, Conf.Lang[Conf.Language].Run_already)
    		return
    	end
    
    	if id == 1 then
    		local i = table.find(Football.Player, Player)
    		if i then
    		    table.remove(Football.Player, i)
    			i = table.find(Football.Team_A, Player)
    			if i then
    			    table.remove(Football.Team_A, i)
    			else
    			    i = table.find(Football.Team_B, Player)
    			    if i then
    			        table.remove(Football.Team_B, i)
    				end
    			end
    		end
    	elseif id == 2 then
    		Player:SendBroadcastMessage(string.format(Conf.Lang[Conf.Language].Wait_Status, Conf.Team_A_Name, table.getn(Football.Team_A), Conf.Team_B_Name, table.getn(Football.Team_B)))
    	elseif id == 3 then
    	    table.insert(Football.Team_A, Player)
    	    Football.Team_A = Football_Clear_Offline(Football.Team_A)
    	    table.insert(Football.Player, Player)
            Football.Player = Football_Clear_Offline(Football.Player)
            Football_Start_Check(Unit)
    	elseif id == 4 then
    	    table.insert(Football.Team_B, Player)
    	    Football.Team_B = Football_Clear_Offline(Football.Team_B)
    	    table.insert(Football.Player, Player)
    	    Football.Player = Football_Clear_Offline(Football.Player)
    	    Football_Start_Check(Unit)
    	elseif id == 5 then
            Football_On_Select(Unit,_,Player,_,math.random(3,4))
    	elseif id == 6 then
    		Football_Event("start", Unit)
    	end
    	
    	Player:GossipComplete()
    
    end
    
    
    -- Game Handle --
    
    function Football_On_Spawn(Unit)
    	if Football.Run == true then
    		Unit:RegisterEvent("Football_Move_Check", 500, 0)
    	else
    		Unit:SendChatMessage(12, 0, "Dont spawn me, GM. I spawn automatic!")
    		Unit:Despawn(1,0)
    	end
    end
    
    function Football_Move_Check(Unit)
    
    	for _,ply in pairs(Unit:GetInRangePlayers()) do
    		if not table.find(Football.Rezz, ply, 1) then
    			if ply:GetHealthPct() == 0 then
    				if Conf.Luapparc == true then
    					if table.find(Football.Team_A, ply) then
    						ply:Teleport(GetMapId(Unit), Conf.Rezz_A.x, Conf.Rezz_A.y, Conf.Rezz_A.z, 0)
    					else
    						ply:Teleport(GetMapId(Unit), Conf.Rezz_B.x, Conf.Rezz_B.y, Conf.Rezz_B.z, 0)
    					end
    				end
    				table.insert(Football.Rezz, {ply, 20})
    			end
    		end
    	end
    	
    	for i,ply in pairs(Football.Rezz) do
    		Football.Rezz[i][2] = ply[2] - 1
    		if ply[2] - 1 <= 0 then
    			if Conf.Luapparc == false then
    				if ply[1]:IsDead() then
    					if table.find(Football.Team_A, ply[1]) then
    						ply[1]:Teleport(GetMapId(Unit), Conf.Rezz_A.x, Conf.Rezz_A.y, Conf.Rezz_A.z, 0)
    					else
    						ply[1]:Teleport(GetMapId(Unit), Conf.Rezz_B.x, Conf.Rezz_B.y, Conf.Rezz_B.z, 0)
    					end
    					ply[1]:ResurrectPlayer()
    					table.remove(Football.Rezz, i)
    				else
    					Football.Rezz[i] = {ply[1], 20}
    				end				
    			else
    				ply[1]:ResurrectPlayer()
    				table.remove(Football.Rezz, i)
    			end
    		else
    			if math.iseven(ply[2]) then
    				ply[1]:SendBroadcastMessage(string.format(Conf.Lang[Conf.Language].Second_To_Wait, ply[2]/2))
    			end
    		end
    	end	
    
    	local ux = Unit:GetX()
    	local uy = Unit:GetY()
    	
    	if math.between(Football.Ecke_B.y-10, Football.Ecke_A.y+10, uy) then
    		if ux < Football.Ecke_A.x+2 then
    			Football.Points_A = Football.Points_A + 1
    			Football_Event("goal", "A")
    			return
    		elseif ux > Football.Ecke_B.x-2 then                               
    			Football.Points_B = Football.Points_B + 1
    			Football_Event("goal", "B")
    			return
    		end
    	end
    	
    	local Player = Unit:GetClosestPlayer()
    	if table.find(Football.Player, Player) then
    	    local Dist = entry.GetDistance(Player, ux, uy)
    	    
    		if Dist < 3 and Dist > 0 then
    		
    		    if Football.Last_Player ~= Player then
                   Football_Event("player_change", Player)
                   Football.Last_Player = Player
    			end
    
    			local xmove = (ux - Player:GetX())
    			local ymove = (uy - Player:GetY())
    
    			local c = (xmove^2 + ymove^2)^0.5
    			local multi = c/(7-(Dist*2))
    			xmove = xmove/multi
    			ymove = ymove/multi
    			
    			xmove, ymove = Football_Check_Movement(ux, uy, xmove, ymove)
    
    	        Unit:MoveTo(ux + xmove, uy + ymove, Player:GetZ(), 0)
    		end
    	end
    Second:
    Code:
    function On_Gossip(unit, event, player)
    unit:RemoveEvents()
    if (player:IsInCombat() == true) then
    player:SendAreaTriggerMessage("Sorry, you have to leave combat first!")
    else  
    unit:GossipCreateMenu(100, player, 0)
    unit:GossipMenuAddItem(5, "[Bet 1 Coin]", 1, 0)
    unit:GossipMenuAddItem(5, "[Bet 2 Coins]", 2, 0)
    unit:GossipMenuAddItem(5, "[Bet 5 Coins]", 3, 0)
    unit:GossipSendMenu(player)
    end
    end
    
    if (intid == 3) then
    if (player:GetItemCount(ITEMID) < 5) then
    player:SendAreaTriggerMessage("You don't have enough coins to bet!")
    else
    unit:GossipCreateMenu(200, player, 0)
    unit:GossipMenuAddItem(4, "Bet 5 Coins", 8, 0)
    unit:GossipMenuAddItem(4, "[BACK]", 7, 0)
    unit:GossipSendMenu(player)
    end
    end 
    
    if (intid == 8) then
    Choice=math.random(1, 4)
    if Choice==1 then
    player:SendAreaTriggerMessage("You won (5) Coins! You gambling whore!")
    unit:FullCastSpellOnTarget(33082, player)
    unit:FullCastSpellOnTarget(33081, player)
    unit:FullCastSpellOnTarget(33077, player)
    unit:FullCastSpellOnTarget(33078, player)
    unit:FullCastSpellOnTarget(33079, player)
    unit:FullCastSpellOnTarget(33080, player)
    player:AddItem(ITEMID, 5)
    end
    if Choice==2 then
    player:SendAreaTriggerMessage("You lost (5) Coins, better luck next time!")
    player:RemoveItem(ITEMID, 5)
    end
    if Choice==3 then
    player:SendAreaTriggerMessage("You lost (5) Coins, better luck next time!")
    player:RemoveItem(ITEMID, 5)
    end
    if Choice==4 then
    player:SendAreaTriggerMessage("You lost (5) Coins, better luck next time!")
    player:RemoveItem(ITEMID, 5)
    end
    end
    
    if (intid == 1) then
    if (player:GetItemCount(ITEMID) < 1) then
    player:SendAreaTriggerMessage("You don't have enough coins to bet!")
    else
    unit:GossipCreateMenu(100, player, 0)
    unit:GossipMenuAddItem(4, "Bet 1 Coin", 5, 0)
    unit:GossipMenuAddItem(4, "[BACK]", 7, 0)
    unit:GossipSendMenu(player)
    end
    end
    
    if (intid == 5) then
    Choice=math.random(1, 2)
    if Choice==1 then
    player:SendAreaTriggerMessage("You won (1) Coin!")
    player:AddItem(ITEMID, 1)
    end
    if Choice==2 then
    player:SendAreaTriggerMessage("You lost (1) Coin, better luck next time!")
    player:RemoveItem(ITEMID, 1)
    end
    end
    
    if (intid == 2) then
    if (player:GetItemCount(ITEMID) < 2) then
    player:SendAreaTriggerMessage("You do not have enough coins to bet!")
    else
    unit:GossipCreateMenu(100, player, 0)
    unit:GossipMenuAddItem(4, "Bet 2 Coins", 6, 0)
    unit:GossipMenuAddItem(4, "[BACK]", 7, 0)
    unit:GossipSendMenu(player)
    end
    end
    
    if (intid == 6) then
    Choice=math.random(1, 2)
    if Choice==1 then
    player:SendAreaTriggerMessage("You won (2) Coins!")
    player:AddItem(ITEMID, 2)
    end
    if Choice==2 then
    player:SendAreaTriggerMessage("You lost (2) Coins, better luck next time!")
    player:RemoveItem(ITEMID, 2)
    end
    end
    
    RegisterUnitGossipEvent(98231, 1, "On_Gossip")
    RegisterUnitGossipEvent(98231, 2, "Gossip_Submenus")
    And third:
    Code:
    function On_Gossip(Unit, Event, Player)
    player:AdvanceSkill(264, 500)
    player:AdvanceSkill(5011, 500)
    player:AdvanceSkill(1180, 500)
    player:AdvanceSkill(204, 500)
    player:AdvanceSkill(15590, 500)
    player:AdvanceSkill(266, 500)
    player:AdvanceSkill(196, 500)
    player:AdvanceSkill(198, 500)
    player:AdvanceSkill(201, 500)
    player:AdvanceSkill(200, 500)
    player:AdvanceSkill(227, 500)
    player:AdvanceSkill(2567, 500)
    player:AdvanceSkill(197, 500)
    player:AdvanceSkill(199, 500)
    player:AdvanceSkill(202, 500)
    player:AdvanceSkill(203, 500)
    player:AdvanceSkill(5009, 500)
    end
    end
    
    RegisterUnitGossipEvent(208266, 1, "On_Gossip")
    RegisterUnitGossipEvent(208266, 2, "Gossip_Submenus")
    PLS YOU GUYS HELP,YOU ARE THE BEST!

    Few script errors
  2. #2
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First we need the errors that appear in the world.exe
    Life Puzzler WoW - Website | Forums

  3. #3
    rekbu's Avatar Member
    Reputation
    2
    Join Date
    Jul 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no(thats is confusing) exept for second one :Try to call invalid LUA function Gossip_Submenus!

Similar Threads

  1. LUA Script Error, Help would be appreciated!
    By pachuco55 in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 06-20-2008, 06:03 PM
  2. Script Error
    By delldude1989 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 04-06-2008, 03:41 PM
  3. [Help me] Lua script error? please help.
    By Szharz in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-22-2008, 12:20 PM
  4. Scripting Error (link fatal)
    By djkajabaxd in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 02-23-2008, 10:46 AM
  5. [HELP] A few scripts for FreeBSD
    By samtron in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 01-09-2008, 09:47 PM
All times are GMT -5. The time now is 07:43 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search