Flaver
21.02.2009, 16:19
Hi,
ich hab ein kleines Problem..., da ich noch ein Lua Anfänger bin.
Ich wollte ein ULX abhängiges Playermenu für den Server schreiben.
Weiß aba leider nicht warum das nicht funktioniert... Könnt ihr mir
helfen?
Code:function PlayerMenu ( ply, all )
if string.find ( text, "/menu" ) == 1 then
playerName = player.GetName( player )
local PMenu = vgui.Create( "DFrame" )
PMenu:SetPos( 50,50 )
PMenu:SetSize( 500, 500 )
PMenu:SetTitle( "PlayerMenu - by FlaVeR" )
PMenu:SetVisible( true )
PMenu:SetDraggable( true )
PMenu:ShowCloseButton( true )
PMenu:MakePopup( )
end
local God = vgui.Create( "DButton", PMenu )
God:SetText( "GoD" )
God:SetPos( 70, 50 )
God:SetSize( 50, 25 )
God.DoClick = function()
RunConsoleCommand( "ulx god "..playerName.." " )
end
local Ungod = vgiu.Create( "DButton", PMenu )
Ungod:SetText( "Ungod" )
Ungod:SetPos( 150, 50 )
Ungod:SetSize( 50, 25 )
Ungod.DoClick = function()
RunConsoleCommand ( "ulx ungod" )
end
local Noclip = vgui.Create( "DButton", PMenu )
Noclip:SetText( "Noclip" )
Noclip:SetPos( 110, 50 )
Noclip:SetSize( 50, 25 )
Noclip.DoClick = function()
RunConsoleCommand( "ulx noclip "..playerName.." " )
end
local 100HP = vgui.create( "DButton", PMenu )
100HP:SetText( "100 HP" )
100HP:SetPos( 190, 50 )
100HP:SetSize( 50, 25 )
100HP.DoClick = function()
RunConsoleCommand( "ulx hp "..playerName.." 100" )
end
hook.Add ( "PlayerMenu", "Menu for Player's", PlayerMenu )
ich hab ein kleines Problem..., da ich noch ein Lua Anfänger bin.
Ich wollte ein ULX abhängiges Playermenu für den Server schreiben.
Weiß aba leider nicht warum das nicht funktioniert... Könnt ihr mir
helfen?
Code:function PlayerMenu ( ply, all )
if string.find ( text, "/menu" ) == 1 then
playerName = player.GetName( player )
local PMenu = vgui.Create( "DFrame" )
PMenu:SetPos( 50,50 )
PMenu:SetSize( 500, 500 )
PMenu:SetTitle( "PlayerMenu - by FlaVeR" )
PMenu:SetVisible( true )
PMenu:SetDraggable( true )
PMenu:ShowCloseButton( true )
PMenu:MakePopup( )
end
local God = vgui.Create( "DButton", PMenu )
God:SetText( "GoD" )
God:SetPos( 70, 50 )
God:SetSize( 50, 25 )
God.DoClick = function()
RunConsoleCommand( "ulx god "..playerName.." " )
end
local Ungod = vgiu.Create( "DButton", PMenu )
Ungod:SetText( "Ungod" )
Ungod:SetPos( 150, 50 )
Ungod:SetSize( 50, 25 )
Ungod.DoClick = function()
RunConsoleCommand ( "ulx ungod" )
end
local Noclip = vgui.Create( "DButton", PMenu )
Noclip:SetText( "Noclip" )
Noclip:SetPos( 110, 50 )
Noclip:SetSize( 50, 25 )
Noclip.DoClick = function()
RunConsoleCommand( "ulx noclip "..playerName.." " )
end
local 100HP = vgui.create( "DButton", PMenu )
100HP:SetText( "100 HP" )
100HP:SetPos( 190, 50 )
100HP:SetSize( 50, 25 )
100HP.DoClick = function()
RunConsoleCommand( "ulx hp "..playerName.." 100" )
end
hook.Add ( "PlayerMenu", "Menu for Player's", PlayerMenu )