• Round Events Help
    1 replies, posted
So for my round events script (TTT) I wasn't sure where to put it. It uses "function roundstart ()" and the "TTTPrepareRound" hook. I tried putting it into init.lua of terrortown to test it out. There are 3 rounds so I set math.random (1,3) as a test to see if they all worked correctly. However after I restart the map on my server or just restart the server it comes up as a normal round of TTT. I added a print "testing" under the give command to see if the round was working correctly but to no avail. Have I put my script into the wrong file? or have I forgotten something? [CODE]hook.Add("TTTPrepareRound", "event", function() function roundstart () Math.random (1,3) if Math.random == 3 then ply:Give ("weapon_ttt_dildo") print("testing event") then WeaponTable = {"weapon_ttt_dildo", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is a Dildo Launcher round! Don't play this in front of your parents!" ) end elseif math.random == 2 then ply:Give ("weapon_ttt_rpg") print("testing event") WeaponTable = {"weapon_ttt_rpg", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is an RPG round! Don't get hurt!" ) end elseif Math.random == 4 then ply:Give ("weapon_ttt_minigun") print("testing event") WeaponTable = {"weapon_ttt_minigun", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is a Minigun round! Bullets will fly!" ) end end end end end end end)[/CODE] [editline]9th February 2014[/editline] [QUOTE=Aeternal;43848453]So for my round events script (TTT) I wasn't sure where to put it. It uses "function roundstart ()" and the "TTTPrepareRound" hook. I tried putting it into init.lua of terrortown to test it out. There are 3 rounds so I set math.random (1,3) as a test to see if they all worked correctly. However after I restart the map on my server or just restart the server it comes up as a normal round of TTT. I added a print "testing" under the give command to see if the round was working correctly but to no avail. Have I put my script into the wrong file? or have I forgotten something? [CODE]hook.Add("TTTPrepareRound", "event", function() function roundstart () Math.random (1,3) if Math.random == 3 then ply:Give ("weapon_ttt_dildo") print("testing event") then WeaponTable = {"weapon_ttt_dildo", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is a Dildo Launcher round! Don't play this in front of your parents!" ) end elseif math.random == 2 then ply:Give ("weapon_ttt_rpg") print("testing event") WeaponTable = {"weapon_ttt_rpg", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is an RPG round! Don't get hurt!" ) end elseif Math.random == 4 then ply:Give ("weapon_ttt_minigun") print("testing event") WeaponTable = {"weapon_ttt_minigun", "weapon_zm_improvised","weapon_zm_carry"} function PlayerCanPickupWeapon( ply, wep ) if ply:Team() == 1 ang table.HasValue( WeaponTable, wep:GetClass() ) then return false end return trueendhook.Add( "PlayerCanPickupWeapon", "Team1_PlayerCanPickupWeapon", PlayerCanPickupWeapon ) for player, v in pairs(player.GetAll()) do v:ChatPrint( "This is a Minigun round! Bullets will fly!" ) end end end end end end end)[/CODE][/QUOTE] I just noticed that most of my math.randoms are capital. I'll try lower casing them and report back Ok so that didn't fix anything really. The round is still the same
Can anyone tell me if there is anything missing or wrong with my script? Or if I've added it to the wrong file?
Sorry, you need to Log In to post a reply to this thread.