• How to make "choose weapon" menu?
    8 replies, posted
Hello. I want to create a weapon menu, like this. https://files.facepunch.com/forum/upload/172298/f86a5f14-b73d-478e-950c-5e8327a115f8/OrJdxVT.png anyone knows?
draw.RoundedBox Use Player/AddPlayerOption or vgui.Create GM/KeyPress
A derma panel would be nicer if you asked me. Might take longer time to make it look ”polished” but its more ”customizable”.
what is wrong? function GM:PlayerSpawn( ply ) function weaponmenu( pl ) pl:Give( "fas2_ak47" ) end function drawpanel() draw.RoundedBox( 2, 500, 500, 100, 100, Color( 255, 255, 255, 100 ) ) Player:AddPlayerOption( "Choose your weapon" , 99999, weaponmenu, drawpanel )  end
PlayerSpawn is serversided, draw.RoundedBox is client sided, Player:AddOption ... the "player" part doesnt exist, and all your code is looping its self... just saying, not trying to be rude, but don't start lua with this, start it will a youtube video or a tutorial, so you can understand the mere basics. Then come back and try again
I already watched some tutorial videos on YouTube, but it is too hard for me to understand what they are saying, cuz my speech perception is not ok)
Then you are going to have to go on gmod wiki, translate the page and read over it? "Gmod Lua Basics" for example.
Well, ok. I'll help you a little. Working example Tracking spawning To track every player spawning you need this hook name: PlayerSpawn Create hook and send .net to player who was spawned. 2. Catching You need to catch .net and create AddPlayerOption Player:AddPlayerOption(unique name , timeout in seconds , function on pressing button , drawing function ) Unique name - just id Timeout - after n seconds window will close Function on pressing - will return number from 0-9 Drawing function - Visual frame. Do not create derma! 3. Giving Give function is serverside, so you need to call .net again to server. Example: function requestweapon(num) net.Start("SelectWeapon") net.WriteInt(num,5) net.SendToServer() end function drawfunction() draw.RoundedBox(4,300,300,100,100,Color(0,0,0,200)) draw.DrawText("Select Weapon\n1- AK47\n2- Five Seven","DermaDefault",310,310,Color(255,255,255)) end net.Receive("SelectWeapon",function() LocalPlayer():AddPlayerOption("SelectWeapon",30,requestweapon,drawfunction) end
Thanks a lot =)
Sorry, you need to Log In to post a reply to this thread.