• The function aren't even ran?
    1 replies, posted
The function here is not even ran. Its called on GM:Initialize() in a different file however it prints to my console that gamemode/shared.lua have been loaded. Been trying to get it working for 40 minutes so I give this a try. [lua] team.SetUp(1, "Pedobear", Color(255,156,0,255) ) team.SetUp(2, "Runner", Color(19,19,19,255) ) print("gamemode/shared.lua has been loaded") RoundIsEnd = 0 pedoBear_table_players = {} pedoBear = pedoBear or {} pedoBear.defaultModel = "models/player/p2_chell.mdl" pedoBear.players = 0 pedoBear.requiredPlayers = 2 pedoBear.roundTime = 600 pedoBear.time = 0 pedoBear.textHUD = "Waiting for players" HUDText = "" HasNotBeenDone = true function GM:RoundStart() if RoundIsEnd != 0 then return end if #player.GetAll() >= pedoBear.requiredPlayers and HasNotBeenDone then HasNotBeenDone = false for _,v in pairs ( player.GetAll() ) do table.insert( pedoBear_table_players, v) end timer.Create("RoundTimer", 1, pedoBear.roundTime, function() timer.Simple(10, function() local choosen = table.Random( pedoBear_table_players ) choosen:SetTeam( 1 ) choosen:PrintMesage(HUD_PRINTTALK, "You are pedobear!") for _,v in pairs ( player.GetAll() ) do v:PrintMessage(HUD_PRINTTALK, choosen:Nick().." are the pedobear!") end end) if pedoBear.time >= 30 then RoundIsEnd = 1 GAMEMODE:RoundPause() timer.Destroy("RoundTimer") if ply:Team() == 1 and ply:IsAlive() then if team.NumPlayers( ply:Team() ) > 0 then ply:addMoney( 200 ) ply:PrintMessage(HUD_PRINTTALK, "You won this round and got $200 as award. Congrats and don't spend them all at same time") for _,v in pairs ( player.GetAll() ) do v:PrintMessage(HUD_PRINTTALK, "Pedobear has raped every single of the runners!") end end elseif ply:Team() == 2 and ply:IsAlive() then if team.NumPlayers( ply:Team() ) > 0 then for _,v in pairs ( team.GetPlayers( ply:Team() ) ) do if v:IsAlive() then v:addMoney(150) v:PrintMessage(HUD_PRINTTALK, "Runners won but you died but you will still get a $150 award.") else v:addMoney(250) v:PrintMessage(HUD_PRINTTALK, "Pedobear got arrested by xXx420cops and they gave you $250 award for catching a pedophile that have raped a lot of people!") end end end end else pedoBear.time = pedoBear.time + 1 print("Round time: "..pedoBear.time) end end) end end function GM:RoundPause() if RoundIsEnd != 1 then return; end table.Empty( pedoBear_table_players ) for _,v in pairs ( player.GetAll() ) do v:PrintMessage(HUD_PRINTTALK, "In 10 seconds the next round will begin") timer.Simple(10, function() v:PrintMessage(HUD_PRINTTALK, "Round has begun") end) end timer.Simple(10, function() RoundIsEnd = 0 HasNotBeenDone = true; GAMEMODE:RoundStart() end) end[/lua]
Make sure you addcslua and include it where it needs to be included
Sorry, you need to Log In to post a reply to this thread.