• how do i make my derma spawn a weapon
    2 replies, posted
I have made this derma and i was wondering how when you press the button instead of it spawning a model it spawns a weapon/entity, if you do this please leave where the weapon/entity goes for each button blank of <entityhere> [lua]function shop() local drugs = {} drugs[1] = "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl" drugs[2] = "models/katharsmodels/syringe_out/syringe_out.mdl" drugs[3] = "models/cocn.mdl" drugs[4] = "models/drug_mod/the_bottle_of_water.mdl" drugs[5] = "models/ipha/mushroom_small.mdl" drugs[6] = "models/boxopencigshib.mdl" drugs[7] = "models/smile/smile.mdl" drugs[8] = "models/jaanus/aspbtl.mdl" local frame = vgui.Create("DFrame") local IconList = vgui.Create( "DPanelList", frame ) frame:Center() frame:SetSize(220,200) frame:SetTitle("npc Shop") frame:MakePopup() IconList:EnableVerticalScrollbar( true ) IconList:EnableHorizontal( true ) IconList:SetPadding( 4 ) IconList:SetPos(10,30) IconList:SetSize(200, 160) for k,v in pairs(drugs) do local icon = vgui.Create( "SpawnIcon", IconList ) icon:SetModel( v ) IconList:AddItem( icon ) icon.DoClick = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("gm_spawn", v) end end concommand.Add( "npcshop1", shop ) end [/lua]
make a console command where you can have a prefex after it like Buy mp5 and do that its not really hard
What, i dont get that? Anyway, how can i make it when they press the button it runs a console command for that button?
Sorry, you need to Log In to post a reply to this thread.