i've resorted to this for now
[code]hook.Add("TTTPrepareRound", "weather", function()
if SERVER then
chance = math.random(0,100)
weathertime = math.random(0,24)
weathertimestring = "!settime "..weathertime
RunConsoleCommand( "say", weathertimestring)
if chance < 600 then
tableweather = {
("!weather rain"),
("!weather fog"),
("!weather blizzard"),
("!weather snow"),
("!weather storm")}
weatherchoice = table.Random(tableweather)
RunConsoleCommand("say", weatherchoice)
RunConsoleCommand("say", "weather test")
else RunConsoleCommand("say", "!weather none)
end
end
end)
[/code]
That is a horrible solution.
shit even that doesnt work
console types this
[code]Console: "!settime 19"
Console: "!weather storm"
Console: "weather test"
[/code]
Try game.ConsoleCommand("ulx settime x\n")
i know its a horrible solution that's why I said (for now), although it doesnt work
[editline]7th October 2015[/editline]
alright, thanks
[editline]7th October 2015[/editline]
[QUOTE=stev_;48847771]Try game.ConsoleCommand("ulx settime x\n")[/QUOTE]
thanks, works great!
[code]hook.Add("TTTPrepareRound", "weather", function()
if SERVER then
chance = math.random(0,100)
weathertime = math.random(0,24)
game.ConsoleCommand("ulx settime "..weathertime.."\n")
if chance < 600 then
tableweather = {
("weather rain"),
("weather fog"),
("weather blizzard"),
("weather snow"),
("weather storm")}
weatherchoice = table.Random(tableweather)
game.ConsoleCommand("ulx "..weatherchoice.."\n")
else game.ConsoleCommand("ulx weather none\n")
end
end
end)[/code]
edit: which piece of code is better to use? the above? or the below?
[code]hook.Add("TTTPrepareRound", "weather", function()
if SERVER then
game.ConsoleCommand("ulx settime "..math.random(0,24).."\n")
if math.random(0,100) > 60 then
tableweather = {
("weather rain"),
("weather fog"),
("weather snow"),
("weather storm"),
("weather blizzard")}
weatherchoice = table.Random(tableweather)
game.ConsoleCommand("ulx "..weatherchoice.."\n")
else game.ConsoleCommand("ulx weather none\n")
end
end
end)[/code]
Quick question :)
How can i disable, wiremods User from interacting with my ent/printer.
[QUOTE=skullorz;48840128]Check if self.Owner is the LocalPlayer() clientside and, if it is, do your function. I think it errors because other players don't have view models on the client.[/QUOTE]
[code]
if (self.Owner = LocalPlayer()) then
LocalPlayer():GetViewModel():SetMaterial("")
end[/code]
this does not work
I'm getting this error, does anybody know what could cause this?
[CODE]
Aborting HTTP request because pResponse->BSetBodyData() failed (RecvHTTPResponseData)
[/CODE]
Here's my code: It seems to be running fine with this error, but I want to know, why this error is there:
[CODE]
function BB_IsValidUsername(name)
local name=tostring(name)
http.Post(
"https://127.0.0.1/registration.php?do=checkUsername",
{ username = name },
function(responseText, contentLength, responseHeaders, statusCode) --onSuccess
local statusTable = util.JSONToTable(responseText)[1]
local status = statusTable[name] or ""
net.Start("BB_IsValidUsername")
net.WriteString(tostring(status))
net.Broadcast()
end,
function(errorMessage) --onFailure
end
)
end
[/CODE]
[QUOTE=Cheese_3;48847902]Quick question :)
How can i disable, wiremods User from interacting with my ent/printer.[/QUOTE]
You can't, at least not without editing the wire_user code. Just do distance checks in your entities Use function.
How would I add a delay to this so the menu doesn't tend to reopen when you try to close it? I noticed the wiki says that stuff like input.WasKeyPressed is only used for move hooks and this is giving me a little trouble
I know it's something with CurTime(), but I'm not sure what the structure of it is
[code]
hook.Add("Think", "menukey", function()
if input.IsKeyDown(key) and not open then
OpenMenu()
open = true
elseif input.IsKeyDown(key) and open then
CloseMenu()
open = false
end
end)
[/code]
[QUOTE=343N;48848207][code]
if (self.Owner = LocalPlayer()) then
LocalPlayer():GetViewModel():SetMaterial("")
end[/code]
this does not work[/QUOTE]
maybe check your errors first?
there is only one equal sign... when comparing variables, use two equal signs
[editline]7th October 2015[/editline]
[QUOTE=NiandraLades;48850926]How would I add a delay to this so the menu doesn't tend to reopen when you try to close it? I noticed the wiki says that stuff like input.WasKeyPressed is only used for move hooks and this is giving me a little trouble
I know it's something with CurTime(), but I'm not sure what the structure of it is
[code]
hook.Add("Think", "menukey", function()
if input.IsKeyDown(key) and not open then
OpenMenu()
open = true
elseif input.IsKeyDown(key) and open then
CloseMenu()
open = false
end
end)
[/code][/QUOTE]
What are you using this for? You could use a better hook like [URL="http://wiki.garrysmod.com/page/GM/KeyPress"]KeyPress[/URL].
Does anybody know how to change the overhead obstacle heigh?
[url]https://developer.valvesoftware.com/wiki/Dimensions[/url]
[QUOTE=geferon;48853671]Does anybody know how to change the overhead obstacle heigh?
[url]https://developer.valvesoftware.com/wiki/Dimensions[/url][/QUOTE]
By changing player's hull height.
[QUOTE=NiandraLades;48850926]How would I add a delay to this so the menu doesn't tend to reopen when you try to close it? I noticed the wiki says that stuff like input.WasKeyPressed is only used for move hooks and this is giving me a little trouble
I know it's something with CurTime(), but I'm not sure what the structure of it is
[code]
hook.Add("Think", "menukey", function()
if input.IsKeyDown(key) and not open then
OpenMenu()
open = true
elseif input.IsKeyDown(key) and open then
CloseMenu()
open = false
end
end)
[/code][/QUOTE]
Something like this.
[lua]
local nextOpen = 0
hook.Add("Think", "menukey", function()
if input.IsKeyDown(key) and not open and nextOpen < CurTime() then
OpenMenu()
open = true
nextOpen = CurTime() + 1
elseif input.IsKeyDown(key) and open then
CloseMenu()
open = false
end
end)
[/lua]
[QUOTE=roastchicken;48853954][URL="http://wiki.garrysmod.com/page/Player/SetHull"]Player/SetHull[/URL][/QUOTE]
Fuck, didnt see it.
Thanks
[QUOTE=geferon;48853869]How?[/QUOTE]
I am late, but still for awareness:
[img]http://i.imgur.com/ytRoD8P.gif[/img]
I have prediction issues with sethull, like spongy collisions, even if I change the hull on client and server.
I'm currently trying to setup a system where if the mouse cursor is enabled and it goes to a certain point at the edge of the screen then move the view in the direction the pointer is, so far I have this but I can't exactly figure out how to get it to work
Trying here to make it move your screen to the left when the mouse cursor is near the edge
[code]
function GM:CreateMove(cmd)
local x, y = gui.MousePos()
if x < 6 then
local oldang = cmd:GetViewAngles()
local newang = (y - EyePos()):Angle()
oldang.pitch = math.ApproachAngle(oldang.pitch, newang.pitch, FrameTime() * math.max(45, math.abs(math.AngleDifference(oldang.pitch, newang.pitch)) ^ 1.3))
oldang.yaw = math.ApproachAngle(oldang.yaw, newang.yaw, FrameTime() * math.max(45, math.abs(math.AngleDifference(oldang.yaw, newang.yaw)) ^ 1.3))
cmd:SetViewAngles(oldang)
end
end
[/code]
[QUOTE=Robotboy655;48853976]I am late, but still for awareness:
[img]http://i.imgur.com/ytRoD8P.gif[/img][/QUOTE]
Its beacouse im on the phone and i wanted to see if thats the right way or something.
Yes, i know i can still open it on the phone, but im way to lazy
[IMG]http://i.imgur.com/mI38h4D.png[/IMG]
I don't know why, this hides my panel fine but it won't bring in it back up...
[CODE]function togglepanel ()
if PanelTable.base:IsVisible() then
PanelTable.base:SetVisible(false)
else
PanelTable.base:SetVisible(true)
end
end[/CODE]
Am I like, not allowed to have a windows server as my FastDL server, and then the game server run on Linux? Because the files download properly to my client, they're in the root directory of garrysmod inside a folder it creates named 'download', but the files are never read. Thus, missing sounds and textures.
Is there a way to change the crowbar in TTT but only when the player has equipped a specific pointshop item?
Would it be possible to do something like this:
[CODE]
hook.Add("PlayerSpawn","bla", function(ply)
ply:StripWeapon("Weapon_zm_improvised")
ply:Give("newweaponclass")
end )
[/CODE]
This code will only ran when the player has the specific item equipped of course.
[QUOTE=P4sca1;48856817]Is there a way to change the crowbar in TTT but only when the player has equipped a specific pointshop item?
Would it be possible to do something like this:
[CODE]
hook.Add("PlayerSpawn","bla", function(ply)
ply:StripWeapon("Weapon_zm_crowbar")
ply:Give("newweaponclass")
end )
[/CODE]
This code will only ran when the player has the specific item equipped of course.[/QUOTE]
Use the ITEM:OnEquip function to strip the crowbar and give the desired weapon
[QUOTE=JasonMan34;48856902]Use the ITEM:OnEquip function to strip the crowbar and give the desired weapon[/QUOTE]
Then the player would need to holster and equip the item every time to replace the crowbar right?
I want to do it automatically.
Here's what I have so far(not working) (using pointshop 2 btw):
[CODE]
function ITEM:GiveWeapon( )
self:GetOwner( ):Give( self.weaponClass )
end
function ITEM:ReplaceCrowbar()
self:GetOwner():StripWeapon("weapon_zm_improvised")
self:GetOwner():Give( self.weaponClass )
end
function ITEM:PlayerSpawn( ply )
if ply == self:GetOwner( ) then
print(self.loadoutType)
if self.loadoutType == "Crowbar" then
timer.Simple(1, function()
self:ReplaceCrowbar()
end )
else
self:GiveWeapon( )
end
end
end
Pointshop2.AddItemHook( "PlayerSpawn", ITEM )
[/CODE]
Sorry, you need to Log In to post a reply to this thread.