• Fretta open spawnmenu
    0 replies, posted
I am trying to make a spawnmenu for my gamemode in fretta, but I have a problem. I am in the begining, so I didn't change the spawn menu yet. It should be giving weapons. Problem is when i press Q i get lua error: ERROR: GAMEMODE:'OnSpawnMenuOpen' Failed: gamemodes\constraintwars\gamemode\cl_init.lua:110: attempt to call method 'ShowSpawnMenu' (a nil value) I am lua beginner so I don't know where to put the GM:ShowSpawnMenu() function. Thanks for help. cl_init.lua [PHP] function GM:OnSpawnMenuOpen() GAMEMODE:ShowSpawnMenu(); end [/PHP]cl_gmchanger.lua [PHP] local SpawnMenu = nil function GM:ShowSpawnMenu() if ( !IsValid( SpawnMenu ) ) then SpawnMenu = vgui.CreateFromTable( vgui_Splash ) SpawnMenu:SetHeaderText( "Spawn Menu" ) SpawnMenu:SetHoverText( "Buy props here." ) local function = function() LocalPlayer():Give( "weapon_shotgun" ) end local Button = SpawnMenu:AddSelectButton( "Shotgun", function ) Button.m_colBackground = Color(255, 90, 90, 255) local function2 = function() LocalPlayer():GiveAmmo( 30, "buckshot" ) end local Button2 = SpawnMenu:AddSelectButton( "Shotgun Ammo", function2 ) Button2.m_colBackground = Color(255, 90, 90, 255) Button2.Think = function( self ) self:SetDisabled( !LocalPlayer():HasWeapon( "weapon_shotgun" ) ) end SpawnMenu:AddCancelButton() end SpawnMenu:MakePopup() end [/PHP]
Sorry, you need to Log In to post a reply to this thread.