• '(' expected near 'GM'
    5 replies, posted
I am working on a gamemode and I have ran into this error. Which I think is causing my gamemode to not run the code in my init.lua [ERROR] gamemodes/rvb/gamemode/init.lua:8: '(' expected near 'GM' 1. unknown - gamemodes/rvb/gamemode/init.lua:0 And just for some people I will post the whole devlog. (I will reply to myself and post one and If I can't I will edit his one) And here is my init.lua code I think there might be a sintax error somewhere but I can't find any. [LUA]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include('shared.lua') local TEAM_RED, TEAM_BLUE = 1, 2, function GM:PlayerInitialSpawn(ply) if team.NumPlayers(TEAM_RED) > team.NumPlayers(TEAM_BLUE) then ply:SetTeam(TEAM_BLUE) ply:SetModel( "models/player/combine_super_soldier.mdl" ) elseif team.NumPlayers(TEAM_BLUE) > team.NumPlayers(TEAM_RED) then ply:SetTeam(TEAM_RED) ply:SetModel( "models/player/combine_super_soldier.mdl" ) else local r = math.Rand(1,2) if r == 1 then ply:SetTeam(TEAM_RED) ply:SetModel( "models/player/combine_super_soldier.mdl" ) else ply:SetModel( "models/player/combine_super_soldier.mdl" ) ply:SetTeam(TEAM_BLUE) end end ply:SetGravity(1) ply:SetWalkSpeed(250) ply:SetRunSpeed(320) ply:SetCrouchedWalkSpeed(0.3) ply:SetNoCollideWithTeammates(false) end function GM:PlayLoadout(ply) ply:Give("weapon_357") ply:GiveAmmo(24, "357",true) end function GM:PlayerShouldTakeDamage(ply, att) if att:IsPlayer() then if ply:Team() == att:Team() then return false end return true end function GM:CanPlaySuicide() return true end [/LUA] [editline]14th May 2017[/editline] Here is the devlog for anyone who needs it Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\css_content_addon_apr2016' Addon contain game scripts?! Lowering mount priority. (2) Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\hl2e_content_addon_apr2016' Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\inmate core' Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\perfection core' Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\portal 1 cubes' Adding Filesystem Addon 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\addons\security core' Initializing Awesomium.. Failed to load custom font file 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\download\resource\fonts\clearsans-medium.ttf' Failed to load custom font file 'c:\program files (x86)\steam\steamapps\common\garrysmod\garrysmod\download\resource\fonts\stratum2-medium.ttf' No Kinect SDK Unknown command "prophunt_kill_hpgive" Unknown command "prophunt_hunter_blindtime" Unknown command "prophunt_gametime" Unknown command "fnafgm_enabledevmode" Unknown command "fnafgm_disablepower" Unknown command "fnafgm_disablemapsmonitors" Unknown command "fnafgm_timethink_autostart" Unknown command "fnafgm_enablebypass" Unknown command "fnafgm_respawndelay" Unknown command "fnafgm_killextsrplayers" Unknown command "fnafgm_forceseasonalevent" Unknown command "fnafgm_timethink_infinitenights" Unknown command "fnafgm_preventdoorkill" Unknown command "fnafgm_autocleanupmap" Unknown command "fnafgm_ragdolloverride" Unknown command "fnafgm_ragdollinstantremove" Unknown command "fnafgm_deathscreenoverlay" Unknown command "fnafgm_deathscreenfade" Unknown command "fnafgm_respawnenabled" Unknown command "fnafgm_allowflashlight" Unknown command "fnafgm_autorespawn" Unknown command "fnafgm_deathscreenduration" Unknown command "fnafgm_deathscreendelay" Unknown command "elev_slapforce" Unknown command "elev_cooldown" Unknown command "dr_push_collide" Unknown command "dr_notify_rounds_left" Unknown command "dr_realistic_fall_damage" Unknown command "dr_allow_death_pickup" Unknown command "dr_unlimited_ammo" Unknown command "dr_allow_autojump" Unknown command "dr_allow_death_suicide" Unknown command "dr_highlight_admins" Unknown command "dr_death_max" Unknown command "dr_death_rate" Unknown command "dr_total_rounds" Unknown command "dr_roundtime_seconds" Unknown command "SWAP_TEAMS_EVERY_ROUND" Unknown command "HUNTER_KILL_BONUS" Unknown command "HUNTER_FIRE_PENALTY" Changing gamemode to Red VS Blue (rvb) Couldn't mount addon - couldn't find file addons/prophunt_expanded_180470977.gma Couldn't mount addon - couldn't find file addons/minecraft_107816278.gma Couldn't mount addon - couldn't find file addons/king_turret_106676282.gma Couldn't mount addon - couldn't find file addons/portal_fort_improved_104635540.gma Couldn't mount addon - couldn't find file addons/chell_npc_106673627.gma Couldn't mount addon - couldn't find file addons/conpainion_cube_106620678.gma Detecting unused .gma files... Found unused .gma addon: (construction_halted)_aperture_construct_v1_498087246.gma Found unused .gma addon: aperture_construct_v1_(please_read_description)_498087246.gma Found unused .gma addon: area_51_194709790.gma Found unused .gma addon: fact_core_rus_132906731.gma Found unused .gma addon: feline_the_human-cat_699001392.gma Found unused .gma addon: five_nights_at_freddys_-_plushies_394295687.gma Found unused .gma addon: fnaf_1_and_2_required_content_365950689.gma Found unused .gma addon: fs_toysoldiers_171540690.gma Found unused .gma addon: gm_genesis_b24_266666023.gma Found unused .gma addon: jake_2.0_106427033.gma Found unused .gma addon: parakeets_pill_pack_106427033.gma Found unused .gma addon: playx_[discontinued]_106516163.gma Found unused .gma addon: super_mario_princesses_ragdolls_164449803.gma Found unused .gma addon: tf2_demoman_weapons_128106056.gma Found unused .gma addon: tf2_engineer_weapons_127023104.gma Found unused .gma addon: tf2_heavy_weapons_126814879.gma Found unused .gma addon: tf2_medic_weapons_127418088.gma Found unused .gma addon: tf2_pyro_weapons_126816481.gma Found unused .gma addon: tf2_scout_weapons_126815280.gma Found unused .gma addon: tf2_sniper_weapons_126815717.gma Found unused .gma addon: tf2_soldier_weapons_126606604.gma Found unused .gma addon: tf2_spy_weapons_126605997.gma Found unused .gma addon: tool_search_891116528.gma Found unused .gma addon: ttt_skycraft_271451812.gma Finished! Run menu_cleanupgmas to clean up said files Addons have changes - remounting Download Finished END: DownloadAddons Download Finished END: DownloadAddons Download Finished END: DownloadAddons Download Finished END: DownloadAddons Download Finished END: DownloadAddons Download Finished END: DownloadAddons Addons have changes - remounting Not loading addon 'prophunt expanded' - file 'gamemodes/prop_hunt/maps/de_port.lua' not on whitelist Couldn't mount addon [Prophunt Expanded][addons/prophunt_expanded_180470977.gma] Removing bad addon addons/prophunt_expanded_180470977.gma Not loading addon 'Minecraft' - file 'gamemodes/minecraft/entities/autorun/server/rb655_minecraft_torch.lua' not on whitelist Couldn't mount addon [Minecraft][addons/minecraft_107816278.gma] Removing bad addon addons/minecraft_107816278.gma Not loading addon 'addons/king_turret_106676282.gma' - addon header invalid Couldn't mount addon [King Turret][addons/king_turret_106676282.gma] Removing bad addon addons/king_turret_106676282.gma Not loading addon 'addons/portal_fort_improved_104635540.gma' - addon header invalid Couldn't mount addon [portal fort improved][addons/portal_fort_improved_104635540.gma] Removing bad addon addons/portal_fort_improved_104635540.gma Not loading addon 'addons/chell_npc_106673627.gma' - addon header invalid Couldn't mount addon [Chell NPC][addons/chell_npc_106673627.gma] Removing bad addon addons/chell_npc_106673627.gma Not loading addon 'addons/conpainion_cube_106620678.gma' - addon header invalid Couldn't mount addon [Conpainion cube][addons/conpainion_cube_106620678.gma] Removing bad addon addons/conpainion_cube_106620678.gma Changing gamemode to Prophunters (prophunters) Cha
You have an extra comma when declaring your TEAM_RED and TEAM_BLUE variables. [Code]local TEAM_RED, TEAM_BLUE = 1, 2,[/Code] Should be changed to [Code]local TEAM_RED, TEAM_BLUE = 1, 2[/Code]
[QUOTE=CosmicSeagull;52228824]You have an extra comma when declaring your TEAM_RED and TEAM_BLUE variables. [Code]local TEAM_RED, TEAM_BLUE = 1, 2,[/Code] Should be changed to [Code]local TEAM_RED, TEAM_BLUE = 1, 2[/Code][/QUOTE] That fixed one error but now I am getting some new ones. Well not new ones but here are some that still need to be fixed. [ERROR] gamemodes/rvb/gamemode/shared.lua:15: '<eof>' expected near 'until' 1. unknown - gamemodes/rvb/gamemode/shared.lua:0 Also I am still getting [ERROR] gamemodes/rvb/gamemode/init.lua:8: '(' expected near 'GM' 1. unknown - gamemodes/rvb/gamemode/init.lua:0
As for the first new error, that is coming from your shared.lua file, so you'll have to look into that on your own since you have only provided the init.lua. Give it a good look on your own, you probably just made a simple mistake like we all do. [Quote][ERROR] gamemodes/rvb/gamemode/init.lua:51: 'end' expected (to close 'function' at line 41) near '<eof>' 1. unknown - gamemodes/rvb/gamemode/init.lua:0[/Quote] This one is pretty straight forward; the function you declared on line 41 (PlayerShouldTakeDamage) is missing an 'end'. You appear to have added one for each of the conditionals but not for the function block as a whole.
[QUOTE=CosmicSeagull;52228871]As for the first new error, that is coming from your shared.lua file, so you'll have to look into that on your own since you have only provided the init.lua. Give it a good look on your own, you probably just made a simple mistake like we all do. Oh let me provide that. [LUA]GM.Name = "Red Vs Blue" GM.Author = "CH4NCE" DeriveGamemode("base") function GM:Initialize() self.BaseClass.Initialize(self) end local TEAM_RED, TEAM_BLUE = 1, 2, team.setup(1, "Red", Color(247, 54, 54)) team.setup(2, "Blue", Color(0, 174, 255)) until.PrecacheModel( "models/player/combine_super_soldier.mdl" )[/LUA] Also I checked. I don't really see anything wrong.
[QUOTE=benjaminpants;52228921][QUOTE=CosmicSeagull;52228871]As for the first new error, that is coming from your shared.lua file, so you'll have to look into that on your own since you have only provided the init.lua. Give it a good look on your own, you probably just made a simple mistake like we all do. Oh let me provide that. [LUA]GM.Name = "Red Vs Blue" GM.Author = "CH4NCE" DeriveGamemode("base") function GM:Initialize() self.BaseClass.Initialize(self) end local TEAM_RED, TEAM_BLUE = 1, 2, team.setup(1, "Red", Color(247, 54, 54)) team.setup(2, "Blue", Color(0, 174, 255)) until.PrecacheModel( "models/player/combine_super_soldier.mdl" )[/LUA] Also I checked. I don't really see anything wrong.[/QUOTE] [b]util[/b].PrecacheModel, not until. Also, team.[b]SetUp[/b], not setup.
Sorry, you need to Log In to post a reply to this thread.