Okay, seriously, is there something I have to do to get Entity:SetEyeTarget to work? Something I have to set beforehand? No matter what I do with it, Entity:SetEyeTarget just [I]doesn't do anything.[/I] I'm not doing anything special with it, it's just there in ENT:Think. It doesn't matter if I set it to look at the position of another object, or if I just give it an ordinary vector for somewhere on the map. The entity's eyes still stay locked onto the map origin.
I've been trying to fix this for more than a week now, and I haven't gotten anywhere.
Hey guys, I don't actually know how to code lua, I just mess around with addons to modify them to my likings. I'm trying to modify the GryMod script so that the radial menu does the console commands I want. isolated the radial menu code (compared to the original GM12 code from the original addon). I of course only plan using this for personal use, but I can't get it to work.
Here's the error in console:
[code][ERROR] lua/autorun/cl_hud.lua:186: 'end' expected (to close 'for' at line 180) near 'elseif'
1. unknown - lua/autorun/cl_hud.lua:0[/code]
Here's the actual code:
[lua]local soundconvar = CreateClientConVar( "crysishud_enablesounds", 1, false, false )
local smoothconvar = CreateClientConVar( "crysishud_enabletransitions", 1, false, false )
local crytx = surface.GetTextureID( "crysis_button" )
local crycircletx = surface.GetTextureID( "crysis_circle" )
local cryarrowtx = surface.GetTextureID( "crysis_arrow" )
local global_mul, global_mul_goal = 0, 0 //The global multiplier, if this is 0 the menu is hidden, 1 and it's fully visible, between 0 and 1 for transition
local cryx, cryy = ScrW() / 2, ScrH() / 2 //Changing this makes the menu appear in a different place
local selected, oldselected = 0, 0 //Which slot is selected?
local snd_o, snd_c, snd_s, snd_h, snd_e = Sound( "cry_open.wav" ), Sound( "cry_close.wav" ), Sound( "cry_select.wav" ), Sound( "cry_hover.wav" ), Sound( "cry_error.wav" )
local crydist = {} //Distance to center for every slot
for i = 1, 5 do
crydist[i] = 0
end
local weapontab = {} //I love mah tables (don't touch this one)
weapontab["crowbar"] = {}
weapontab["crowbar"].number = "l" //This is the character in the GeneralWeaponIcons font
weapontab["crowbar"].name = "weapon_crowbar" //This is the weapon class name to switch to
weapontab["physcannon"] = {}
weapontab["physcannon"].number = "b"
weapontab["physcannon"].name = "physcannon"
weapontab["physgun"] = {}
weapontab["physgun"].number = "t"
weapontab["physgun"].name = "physgun"
weapontab["pistol"] = {}
weapontab["pistol"].number = "c"
weapontab["pistol"].name = "pistol"
weapontab["revolver"] = {}
weapontab["revolver"].number = "d"
weapontab["revolver"].name = "357"
weapontab["smg"] = {}
weapontab["smg"].number = "e"
weapontab["smg"].name = "smg1"
weapontab["ar2"] = {}
weapontab["ar2"].number = "h"
weapontab["ar2"].name = "ar2"
weapontab["shotgun"] = {}
weapontab["shotgun"].number = "f"
weapontab["shotgun"].name = "shotgun"
weapontab["crossbow"] = {}
weapontab["crossbow"].number = "g"
weapontab["crossbow"].name = "crossbow"
weapontab["grenade"] = {}
weapontab["grenade"].number = "j"
weapontab["grenade"].name = "frag"
weapontab["rpg"] = {}
weapontab["rpg"].number = "i"
weapontab["rpg"].name = "rpg"
weapontab["stunstick"] = {}
weapontab["stunstick"].number = "r"
weapontab["stunstick"].name = "stunstick"
weapontab["slam"] = {}
weapontab["slam"].number = "g"
weapontab["slam"].name = "slam"
weapontab["toolgun"] = {}
weapontab["toolgun"].number = "w"
weapontab["toolgun"].name = "gmod_tool"
weapontab["camera"] = {}
weapontab["camera"].number = "u"
weapontab["camera"].name = "gmod_camera"
local slots = {} //Standard slots, change these at will
slots[1] = weapontab["keys"]
slots[2] = weapontab["physcannon"]
slots[3] = weapontab["physgun"]
slots[4] = weapontab["toolgun"]
slots[5] = weapontab["camera"]
function MouseInCircle( x, y ) //Checks if the mouse is in the circle
local centerdist = math.Dist( gui.MouseX(), gui.MouseY(), x, y )
return ( centerdist > 32 and centerdist < 150 )
end
function CRYHUD() //Good luck figuring all this shit out
if ( global_mul_goal != global_mul ) then
global_mul = global_mul + ( global_mul_goal - global_mul ) * math.Clamp( FrameTimeExt() * 10, 0, 1 ) //I love mah math
end
if ( global_mul == 0 ) then return end //Don't run if the menu ain't visible
surface.SetTexture( crytx )
surface.SetDrawColor( 190, 195, 190, 255 )
surface.SetTextColor( 190, 195, 190, global_mul * 255 )
surface.SetFont("WepIcons")
local cryadd = 360/5
local numb = 1
local cursorang = math.fmod( math.atan2( gui.MouseY() - cryy, gui.MouseX() - cryx ), math.pi * 2 ) //This angle shit makes my head implode
local cursorangd = math.deg( cursorang ) + 180
if ( cursorangd >= 0 and cursorangd < cryadd ) then selected = 4
elseif ( cursorangd >= cryadd and cursorangd < cryadd * 2 ) then selected = 3
elseif ( cursorangd >= cryadd * 2 and cursorangd < cryadd * 3 ) then selected = 2
elseif ( cursorangd >= cryadd * 3 and cursorangd < cryadd * 4 ) then selected = 1
elseif ( cursorangd >= cryadd * 4 and cursorangd < cryadd * 5 ) then selected = 5
end //Fucking hell this took like forever ever to figure out
if ( !MouseInCircle( cryx, cryy ) ) then selected = 0 end //If the mouse isn't in the circle, don't light up any slot
for i = 0 + cryadd / 2, 360 - cryadd / 2, cryadd do
local crydistadd = 96
local crygray = 200
if ( numb == selected ) then //If the slot is selected, light it up and move it outside
crydistadd = crydistadd * 1.3
crygray = 255
end
crydist[numb] = crydist[numb] + ( crydistadd - crydist[numb] ) * math.Clamp( FrameTimeExt() * 20, 0, 1 )
local cryaddx, cryaddy = math.sin( math.rad( i ) ) * crydist[numb] * global_mul, math.cos( math.rad( i ) ) * crydist[numb] * global_mul
local crytxtw, crytxth = surface.GetTextSize( slots[numb].number )
surface.SetDrawColor( crygray, crygray, crygray, global_mul * 200 )
surface.DrawTexturedRectRotated( cryx + cryaddx, cryy + cryaddy, 100 * global_mul, 100 * global_mul, i - 180 )
surface.SetTextPos( cryx + cryaddx - crytxtw / 2, cryy + cryaddy - crytxth / 2 + 10 )
surface.DrawText( slots[numb].number ) //Draw the character
numb = numb + 1
end
surface.SetTexture( crycircletx )
surface.SetDrawColor( 190, 195, 190, global_mul * 255 )
surface.DrawTexturedRectRotated( cryx, cryy, 128 * global_mul, 128 * global_mul, math.fmod( CurTime() * -20, 360 ) )
surface.SetTexture( cryarrowtx )
surface.SetDrawColor( 150, 155, 150, global_mul * 255 )
local arrowang = math.pi * 2 - cursorang + math.pi / 2
local arrowdist = 47 * global_mul
local arrowx, arrowy = math.sin( arrowang ) * arrowdist, math.cos( arrowang ) * arrowdist
surface.DrawTexturedRectRotated( cryx + arrowx, cryy + arrowy, 128 / 3, 32 / 3, math.deg( arrowang ) + 180 )
if ( selected != oldselected and selected != 0 ) then PlaySnd( snd_h ) oldselected = selected end
end
hook.Add( "HUDPaint", "CRYHUD", CRYHUD )
function EnableMenu( b )
if ( ( b and global_mul_goal == 0 ) ) then PlaySnd( snd_o ) end
gui.EnableScreenClicker( b )
if ( b ) then global_mul_goal = 1 else global_mul_goal = 0 end
end
concommand.Add( "crysishud_slots", ChangeSlots, ChangeSlotsAutoComplete )
function CryOpenClose( ply, command, args ) // 1.0 update : Sounds are played by server
if ( command != "+crysishud" ) then
if ( MouseInCircle( cryx, cryy ) ) then
PlaySnd( snd_s )
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "keys" then
RunConsoleCommand( "use keys" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physcannon" then
RunConsoleCommand( "use weapon_physcannon" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physgun" then
RunConsoleCommand( "use weapon_physgun" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "toolgun" then
RunConsoleCommand( "use gmod_tool" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "camera" then
RunConsoleCommand( "use gmod_camera" )
end
elseif ( global_mul_goal == 1 ) then PlaySnd( snd_c ) end
end
EnableMenu( command == "+crysishud" ) //Enable menu if it's +crysishud, disable otherwise
end
concommand.Add(
-snip- (Material missing question)
Thanks, a very VERY gentlemen helped me through this. It was permission issues.
I would like to thanks everyone who helped!
[QUOTE=t h e;38592533]Hey guys, I don't actually know how to code lua, I just mess around with addons to modify them to my likings. I'm trying to modify the GryMod script so that the radial menu does the console commands I want. isolated the radial menu code (compared to the original GM12 code from the original addon). I of course only plan using this for personal use, but I can't get it to work.
If anyone could fix the error for me, I'd be oh so grateful. I can't seem to fix it myself.[/QUOTE]
Add [lua]end --line 184[/lua] on line 184 to close the for k,v you start on line 179
[QUOTE=ms333;38592713]Add [lua]end --line 184[/lua] on line 184 to close the for k,v you start on line 179[/QUOTE]
Yea, I've tried that before and I just tried it again cause of your instructions, but I'm now getting this error
[code]
[ERROR] lua/autorun/cl_hud.lua:186: 'end' expected (to close 'for' at line 180) near 'elseif'
1. unknown - lua/autorun/cl_hud.lua:0
[ERROR] lua/autorun/cl_hud.lua:5: attempt to index global 'surface' (a nil value)
1. unknown - lua/autorun/cl_hud.lua:5
[ERROR] lua/autorun/cl_hud.lua:5: attempt to index global 'surface' (a nil value)
1. unknown - lua/autorun/cl_hud.lua:5
[ERROR] lua/autorun/cl_hud.lua:5: attempt to index global 'surface' (a nil value)
1. unknown - lua/autorun/cl_hud.lua:5
[/code]
Thanks for trying, though. Appreciate it. I'm still baffled.
[QUOTE=t h e;38592792]Yea, I've tried that before and I just tried it again cause of your instructions, but I'm now getting this error
Thanks for trying, though. Appreciate it. I'm still baffled.[/QUOTE]
May I suggest that you put the file in lua/autorun/client ??
Since it's a client script. Maybe it knows that automatically when it's a cl_ file.. I don't know actually.
[QUOTE=ms333;38592854]May I suggest that you put the file in lua/autorun/client ??
Since it's a client script. Maybe it knows that automatically when it's a cl_ file.. I don't know actually.[/QUOTE]
Ah, that seemed like a good idea. Just tried it out (with the added "end" at line 184) but it's giving me the same error [code]
[ERROR] lua/autorun/client/cl_hud.lua:186: 'end' expected (to close 'for' at line 180) near 'elseif'
1. unknown - lua/autorun/client/cl_hud.lua:0
[/code]
You're closing the if statement too early, so you couldn't use elseif.
It would be: (assuming it's just a syntax error).
[code]
for k, v in pairs( player.GetAll() ) do
if( slots[selected] ) and ( slots[selected].name ) == "camera" then
RunConsoleCommand( "use gmod_camera" )
elseif ( global_mul_goal == 1 ) then PlaySnd( snd_c ) end
end
[/code]
Hold on. I've reloaded it. There's no errors in console when the server starts. However, when I hit the key binded to +crysishud it gives me this error:
[code]
[ERROR] lua/autorun/client/cl_hud.lua:145: attempt to call global 'PlaySnd' (a nil value)
1. EnableMenu - lua/autorun/client/cl_hud.lua:145
2. unknown - lua/autorun/client/cl_hud.lua:188
3. unknown - lua/includes/modules/concommand.lua:69
[The|2|STEAM_0:0:21987828] Lua Error:
[ERROR] lua/autorun/client/cl_hud.lua:145: attempt to call global 'PlaySnd' (a nil value)
1. EnableMenu - lua/autorun/client/cl_hud.lua:145
2. unknown - lua/autorun/client/cl_hud.lua:188
3. unknown - lua/includes/modules/concommand.lua:69
[/code]
[editline]25th November 2012[/editline]
[QUOTE=Hmmmmmm;38592984]You're closing the if statement too early, so you couldn't use elseif.
It would be: (assuming it's just a syntax error).
[code]
for k, v in pairs( player.GetAll() ) do
if( slots[selected] ) and ( slots[selected].name ) == "camera" then
RunConsoleCommand( "use gmod_camera" )
elseif ( global_mul_goal == 1 ) then PlaySnd( snd_c ) end
end
[/code][/QUOTE]
Doing this, replacing the following code:
[code] for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "camera" then
RunConsoleCommand( "use gmod_camera" )
end
end
elseif ( global_mul_goal == 1 ) then PlaySnd( snd_c ) end
end[/code]
with your code, gives me the following console errors
[code]
[ERROR] lua/autorun/client/cl_hud.lua:190: 'end' expected (to close 'if' at line 153) near '<eof>'
1. unknown - lua/autorun/client/cl_hud.lua:0
[[HZ]-R The|2|STEAM_0:0:21987828] Lua Error:
[ERROR] lua/autorun/client/cl_hud.lua:190: 'end' expected (to close 'if' at line 153) near '<eof>'
1. unknown - lua/autorun/client/cl_hud.lua:0
[/code]
Should I attempt to use +crysishud (with the script modified as above), it greets me with the same error I got before which is
[code]
[ERROR] lua/autorun/client/cl_hud.lua:145: attempt to call global 'PlaySnd' (a nil value)
1. EnableMenu - lua/autorun/client/cl_hud.lua:145
2. unknown - lua/autorun/client/cl_hud.lua:188
3. unknown - lua/includes/modules/concommand.lua:69
[The|2|STEAM_0:0:21987828] Lua Error:
[ERROR] lua/autorun/client/cl_hud.lua:145: attempt to call global 'PlaySnd' (a nil value)
1. EnableMenu - lua/autorun/client/cl_hud.lua:145
2. unknown - lua/autorun/client/cl_hud.lua:188
3. unknown - lua/includes/modules/concommand.lua:69
[/code]
This part doesn't make any sense. You're looping over all the players multiple times for no reason at all.
[lua]
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "keys" then
RunConsoleCommand( "use keys" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physcannon" then
RunConsoleCommand( "use weapon_physcannon" )
end
end
[/lua]
It should be this.
[lua]
if slots[selected] then
if slots[selected].name == "keys" then RunConsoleCommand( "use keys" )
elseif slots[selected].name == "physcannon" then RunConsoleCommand( "use weapon_physcannon" ) end
end
[/lua]
[QUOTE=Panto;38593370]This part doesn't make any sense. You're looping over all the players multiple times for no reason at all.
[lua]
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "keys" then
RunConsoleCommand( "use keys" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physcannon" then
RunConsoleCommand( "use weapon_physcannon" )
end
end
[/lua]
It should be this.
[lua]
if slots[selected] then
if slots[selected].name == "keys" then RunConsoleCommand( "use keys" )
elseif slots[selected].name == "physcannon" then RunConsoleCommand( "use weapon_physcannon" ) end
end
[/lua][/QUOTE]
Which part replaces which in that case? Would this mean I'd have to make it
[lua]for k,v in pairs(player.GetAll()) do
if slots[selected].name == "keys" then RunConsoleCommand( "use keys" )
elseif slots[selected].name == "physcannon" then RunConsoleCommand( "use weapon_physcannon" )
elseif slots[selected].name == "physgun" then RunConsoleCommand( "use weapon_physgun" )
elseif slots[selected].name == "toolgun" then RunConsoleCommand( "use gmod_toolgun" ) end
end[/lua] for multiple of these?
I want to run a timer (clientside) when the connection between a player and server is interrupted. Any idea? Everything else will run, except for the timer. Should I try some while loop function to make my own timer? xD
[CODE]MsgN("Can you please start a timer for me?")
timer.Simple(1, function() MsgN("Hi!") end)
MsgN("Yeah, just ignore my timer like you always do! -_-")[/CODE]
Output:
"Can you please start a timer for me?"
"Yeah, just ignore my timer like you always do! -_-"
Edit: Alright. I tried to have my own timer but it kills Gmod. ^^
x = RealTime() + 3
while(x > RealTime()) do
end
Welp, I think I messed up big time. Ignore whatever I've done so far, I'm gonna redo it all, I'm pretty sure I left out some key coding.
Instead of snipping just the radial menu code, I'm keeping the entire code there and working off it from there. It's odd though, the original addon itself wasn't connected to it and for some reason I need the rest of the code. It also appears "RunConsoleCommand" only allows one word, but I've made a compromise by using aliases.
What's math.Rad2Deg been replaced with?
Would SomeBody Please Ban Itkuitkzhji For Using Emoticons I Am Greatly Offended By Him Expressing HimSelf Through Text
[QUOTE=amkoc;38594034]What's math.Rad2Deg been replaced with?[/QUOTE]
math.deg according to [url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit[/url]
Wow CSkiddie And Wizard Of Skid Are Viewing This Thread To Just Give It Up Guys Im Not Going To Help You If You Keep Stealing From Me
I think I finally did it. All I have is the radial menu and it seems to work now. It looks like I was missing an extra few lines of code. Final script:
[lua]
if CLIENT then
local soundconvar = CreateClientConVar( "crysishud_enablesounds", 1, false, false )
local smoothconvar = CreateClientConVar( "crysishud_enabletransitions", 1, false, false )
local crytx = surface.GetTextureID( "crysis_button" )
local crycircletx = surface.GetTextureID( "crysis_circle" )
local cryarrowtx = surface.GetTextureID( "crysis_arrow" )
local global_mul, global_mul_goal = 0, 0 //The global multiplier, if this is 0 the menu is hidden, 1 and it's fully visible, between 0 and 1 for transition
local cryx, cryy = ScrW() / 2, ScrH() / 2 //Changing this makes the menu appear in a different place
local selected, oldselected = 0, 0 //Which slot is selected?
local snd_o, snd_c, snd_s, snd_h, snd_e = Sound( "cry_open.wav" ), Sound( "cry_close.wav" ), Sound( "cry_select.wav" ), Sound( "cry_hover.wav" ), Sound( "cry_error.wav" )
local crydist = {} //Distance to center for every slot
for i = 1, 5 do
crydist[i] = 0
end
local armormode = {}
armormode["stunstick"] = {}
armormode["stunstick"].number = "r"
armormode["stunstick"].name = "stunstick"
armormode["physcannon"] = {}
armormode["physcannon"].number = "b"
armormode["physcannon"].name = "physcannon"
armormode["physgun"] = {}
armormode["physgun"].number = "t"
armormode["physgun"].name = "physgun"
armormode["toolgun"] = {}
armormode["toolgun"].number = "w"
armormode["toolgun"].name = "toolgun"
armormode["camera"] = {}
armormode["camera"].number = "u"
armormode["camera"].name = "camera"
local slots = {} //Standard slots, change these at will
slots[1] = armormode["toolgun"]
slots[2] = armormode["physcannon"]
slots[3] = armormode["physgun"]
slots[4] = armormode["stunstick"]
slots[5] = armormode["camera"]
function MouseInCircle( x, y ) //Checks if the mouse is in the circle
local centerdist = math.Dist( gui.MouseX(), gui.MouseY(), x, y )
return ( centerdist > 32 and centerdist < 150 )
end
function CRYHUD() //Good luck figuring all this shit out
if ( global_mul_goal != global_mul ) then
global_mul = global_mul + ( global_mul_goal - global_mul ) * math.Clamp( FrameTimeExt() * 10, 0, 1 ) //I love mah math
end
if ( global_mul == 0 ) then return end //Don't run if the menu ain't visible
surface.SetTexture( crytx )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetTextColor( 255, 255, 255, global_mul * 255 )
surface.SetFont("WepIcons")
local cryadd = 360/5
local numb = 1
local cursorang = math.fmod( math.atan2( gui.MouseY() - cryy, gui.MouseX() - cryx ), math.pi * 2 ) //This angle shit makes my head implode
local cursorangd = math.deg( cursorang ) + 180
if ( cursorangd >= 0 and cursorangd < cryadd ) then selected = 4
elseif ( cursorangd >= cryadd and cursorangd < cryadd * 2 ) then selected = 3
elseif ( cursorangd >= cryadd * 2 and cursorangd < cryadd * 3 ) then selected = 2
elseif ( cursorangd >= cryadd * 3 and cursorangd < cryadd * 4 ) then selected = 1
elseif ( cursorangd >= cryadd * 4 and cursorangd < cryadd * 5 ) then selected = 5
end //Fucking hell this took like forever ever to figure out
if ( !MouseInCircle( cryx, cryy ) ) then selected = 0 end //If the mouse isn't in the circle, don't light up any slot
for i = 0 + cryadd / 2, 360 - cryadd / 2, cryadd do
local crydistadd = 96
local crygray = 200
if ( numb == selected ) then //If the slot is selected, light it up and move it outside
crydistadd = crydistadd * 1.3
crygray = 255
end
crydist[numb] = crydist[numb] + ( crydistadd - crydist[numb] ) * math.Clamp( FrameTimeExt() * 20, 0, 1 )
local cryaddx, cryaddy = math.sin( math.rad( i ) ) * crydist[numb] * global_mul, math.cos( math.rad( i ) ) * crydist[numb] * global_mul
local crytxtw, crytxth = surface.GetTextSize( slots[numb].number )
surface.SetDrawColor( crygray, crygray, crygray, global_mul * 200 )
surface.DrawTexturedRectRotated( cryx + cryaddx, cryy + cryaddy, 100 * global_mul, 100 * global_mul, i - 180 )
surface.SetTextPos( cryx + cryaddx - crytxtw / 2, cryy + cryaddy - crytxth / 2 + 10 )
surface.DrawText( slots[numb].number ) //Draw the character
numb = numb + 1
end
surface.SetTexture( crycircletx )
surface.SetDrawColor( 190, 195, 190, global_mul * 255 )
surface.DrawTexturedRectRotated( cryx, cryy, 128 * global_mul, 128 * global_mul, math.fmod( CurTime() * -20, 360 ) )
surface.SetTexture( cryarrowtx )
surface.SetDrawColor( 150, 155, 150, global_mul * 255 )
local arrowang = math.pi * 2 - cursorang + math.pi / 2
local arrowdist = 47 * global_mul
local arrowx, arrowy = math.sin( arrowang ) * arrowdist, math.cos( arrowang ) * arrowdist
surface.DrawTexturedRectRotated( cryx + arrowx, cryy + arrowy, 128 / 3, 32 / 3, math.deg( arrowang ) + 180 )
if ( selected != oldselected and selected != 0 ) then PlaySnd( snd_h ) oldselected = selected end
end
hook.Add( "HUDPaint", "CRYHUD", CRYHUD )
function EnableMenu( b )
if ( ( b and global_mul_goal == 0 ) ) then PlaySnd( snd_o ) end
gui.EnableScreenClicker( b )
if ( b ) then global_mul_goal = 1 else global_mul_goal = 0 end
end
concommand.Add( "crysishud_slots", ChangeSlots, ChangeSlotsAutoComplete )
function CryOpenClose( ply, command, args ) // 1.0 update : Sounds are played by server
if ( command != "+crysishud" ) then
if ( MouseInCircle( cryx, cryy ) ) then
PlaySnd( snd_s )
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "stunstick" then
RunConsoleCommand( "usestunstick" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physcannon" then
RunConsoleCommand( "usephyscannon" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "physgun" then
RunConsoleCommand( "usephysgun" )
end
end
for k,v in pairs(player.GetAll()) do
if ( slots[selected] ) and ( slots[selected].name ) == "toolgun" then
RunConsoleCommand( "usetoolgun" )
end
end
if ( slots[selected] ) and ( slots[selected].name ) == "camera" then
RunConsoleCommand( "usecamera" )
end
elseif ( global_mul_goal == 1 ) then PlaySnd( snd_c ) end
end
EnableMenu( command == "+crysishud" ) //Enable menu if it's +crysishud, disable otherwise
end
concommand.Add( "+crysishud", CryOpenClose )
concommand.Add( "-crysishud", CryOpenClose )
function PlaySnd( snd )
if ( soundconvar:GetBool() ) then surface.PlaySound( snd ) end
end
function FrameTimeExt()
if ( smoothconvar:GetBool() ) then return FrameTime() else return 1 end
end
end[/lua]
I don't understand a lot of this stuff, but if anyone was just curious on what happened I thought I'd post it anyways. I'll be making a few tweaks here and there so it's more suited for my needs, but thanks for the help everyone, I really appreciated your efforts.
Also, if anybody gets confused over the commands I used in the RunConsoleCommand section, those are aliases, so usetoolgun is actually "use gmod_tool"
Does anyone have an ents.FindInCone replacement that actually finds ents in the specified cone?
With file.Find(), how do I make it relative to my addons lua folder?
I tried:
[lua] local files, directories = file.Find("*.lua", "lua")
PrintTable(files)
print("printed files")[/lua]
But nothing got printed.
To explain it better, I have an addon, positioned:
steamname/garrysmod/garrysmod/addons/myaddon/
and I want to get all the lua files inside of:
steamname/garrysmod/garrysmod/addons/myaddon/lua
but if I put in the code as I placed above, it doesn't return anything, while I'm sure there's a lua file in there.
isn't it file.Find( "*.lua", "LUA" )?
Hmm. I thought it was over, but it wasn't. This is more of a nitpick than anything, but does anyone know why I can't change "armormode" to some other word? I'm just a tad curious, it's my OCD acting up if anything, it doesn't even matter.
Before i make a request and make myself look like a dumbass, Is there a way to find entity in a specified cylinder, with a start, end, and radius?
I'd kill for ents.FindInCylinder.
Does anyone know how you send a rcon command to a server through php/html?
[QUOTE=snixzz10;38594510]Wow CSkiddie And Wizard Of Skid Are Viewing This Thread To Just Give It Up Guys Im Not Going To Help You If You Keep Stealing From Me[/QUOTE]
do you have a facebook account?
Actual question for the people:
is a DImage completely static? i'm attempting to simply change an image on a panel when a certain button is clicked, but i'm shit at derma and don't know what i'm doing. Can someone give me an example of how somebody would create and change an image?
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexacb6.html[/url]
[lua]
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( Material( "vgui/hud_pv" ) )
surface.DrawTexturedRect( ScrW() * 0.5, ScrH() * 0.5, 50, 50 )
[/lua]
Just change the material when the button is clicked, or however you want to do it.
[QUOTE=find me;38597796][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexacb6.html[/url]
[lua]
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( Material( "vgui/hud_pv" ) )
surface.DrawTexturedRect( ScrW() * 0.5, ScrH() * 0.5, 50, 50 )
[/lua]
Just change the material when the button is clicked, or however you want to do it.[/QUOTE]
??
[url]http://glua.me/bin/?path=/lua/vgui/dimage.lua#93[/url]
[lua]
local mat = Material( "path/to/material" )
function mydimage:DoClick()
self:SetMaterial( mat )
-- or
self:SetImage( "path/to/vmt.vmt" )
end[/lua]
[QUOTE=find me;38596397]Does anyone know how you send a rcon command to a server through php/html?[/QUOTE]
[URL]https://developer.valvesoftware.com/wiki/RCON[/URL]
[editline]lolno[/editline]
P.S. Please don't use PHP unless you really, really have to.
[QUOTE=wizardsbane;38600391][URL]https://developer.valvesoftware.com/wiki/RCON[/URL]
[editline]lolno[/editline]
P.S. Please don't use PHP unless you really, really have to.[/QUOTE]
What else (on a PHP webserver)?
[QUOTE=Darkwater124;38600508]What else (on a PHP webserver)?[/QUOTE]
If you're, for some peculiar reason, restricted to a PHP webserver then whatever.
There are free Python and Ruby hosts if that's the issue.
Sorry, you need to Log In to post a reply to this thread.