[QUOTE=fghdx;46625825]Yep.[/QUOTE]
Like what is it returning? Nothing or a random series of numbers?
[QUOTE=ROFLBURGER;46625837]Like what is it returning? Nothing or a random series of numbers?[/QUOTE]
It is returning a time stamp. As expected. It it just not the clients system time like I want.
os.date("%I:%M", os.time())
[QUOTE=fghdx;46626193]It is returning a time stamp. As expected. It it just not the clients system time like I want.[/QUOTE]
If you want a pretty formatted time string, you have to use the argument.
EDIT:
What he said^
[QUOTE=fghdx;46626193]It is returning a time stamp. As expected. It it just not the clients system time like I want.[/QUOTE]
If you want more infomation on this.
os.time returns epoch time which is the seconds passed since January 1, 1970 UTC.
[URL="http://wiki.garrysmod.com/page/os/date"]os.date [/URL] can be used to format it (as said above)
[URL="http://www.lua.org/pil/22.1.html"]The Lua pil may be helpful if you want to format the time differently.[/URL]
How to get map maximum height? (Vector.z). Entity(0):OBBMaxs() return Vector(0,0,0).
[QUOTE=UnkN;46626346]How to get map maximum height? (Vector.z). Entity(0):OBBMaxs() return Vector(0,0,0).[/QUOTE]
I'm not entirely sure I get the question? Well, anyway, the maximum value on any axis, x, y, or z, is either positive or negative 16384 units. I've experienced some problems with having anything even near those coordinates though.
[QUOTE=UnkN;46626346]How to get map maximum height? (Vector.z). Entity(0):OBBMaxs() return Vector(0,0,0).[/QUOTE]
I did this once. If I recall correctly you have to do this.
game.GetWorld():GetPhysicsObject():GetAABB()
There was an issue of this not working on the client, but it was supposed to get fixed in one of the past updates.
EDIT: Just tried it, still doesn't work on the client so you should network it with NWints or use Net.
[t]http://puu.sh/df46b/ecbe7f6771.png[/t]
EDIT 2 It wasn't that it was going to be fixed, it was that Entity(0) would return the same result (or something along those lines)
[QUOTE=WalkingZombie;46626383]I'm not entirely sure I get the question? Well, anyway, the maximum value on any axis, x, y, or z, is either positive or negative 16384 units. I've experienced some problems with having anything even near those coordinates though.[/QUOTE]
I wants to create snow particle from sky, but I need map maximum Z (TOP, Skybox). For example, in map mu_pratum I set particle spawn z to 890. Another snow particle collide with map and stuck in top.
[QUOTE=UnkN;46626499]I wants to create snow particle from sky, but I need map maximum Z (TOP, Skybox). For example, in map mu_pratum I set particle spawn z to 890. Another snow particle collide with map and stuck in top.[/QUOTE]
Hmm... I like to use the valve particle system :smile: which can do thing like, what most actual games do these days... just a big sphere around the player, creating falling particles inside. When the particles hit something, they die.
That's really most effective when you're always outside though, so otherwise just using a flat cylinder as the source would work, so many units above the player so as not to be inside; also, called clientside so other players dont see some weird weather indoors higher up...
[editline]3rd December 2014[/editline]
Maybe it's not most games, but from what I've actually paid attention to in my spare time, that's what they do.
Is there a way of finding out if somebody is an error? For example if you join a server and you haven't installed content. Is there a way of finding out the players' model isn't installed?
On the client, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/file/Exists]file.Exists[/url]
Is there a function or a method of checking if the server is dedicated or not?
nvm I should actually google shit before I ask, I thought it would be more complex than a function that is literally called IsDedicated
[QUOTE=ROFLBURGER;46631458]Is there a function or a method of checking if the server is dedicated or not?[/QUOTE]
game.IsDedicated
[img]http://i.imgur.com/YvdpO2f.png[/img]
[QUOTE=ROFLBURGER;46631458]Is there a function or a method of checking if the server is dedicated or not?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/game/IsDedicated]game.IsDedicated[/url]
ERP. CURSE YOU NINJAS!
Can someone tell me how to make a right-click context menu?
[QUOTE=GGG KILLER;46631483]Can someone tell me how to make a right-click context menu?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/DermaMenu]Global.DermaMenu[/url]
[QUOTE=bobbleheadbob;46631499][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/DermaMenu]Global.DermaMenu[/url][/QUOTE]
Yeah, just remembered it(but I think thats actually this: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:DMenu]DMenu[/url] )
EDIT: Nvm, they're actually the same thing.
[QUOTE=UnkN;46626346]How to get map maximum height? (Vector.z). Entity(0):OBBMaxs() return Vector(0,0,0).[/QUOTE]
The difference between the OBB Mins / Maxs would be it.
You could also just grab the Mids and multiply by 2 ( If the item doesn't have a negative mins... Although, I can't recall whether or not the Mids adjusts for that but it most likely doesn't so the first answer would be best ).
Here is one example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/entities/spawn_entity_in_front_of_player_by_calc_size_of_object.lua.html[/url]
Alright this may not be the right place to ask this but. I'm trying to make a php script that is called in-game to automatically ban a player off all of the servers I own. I've got the ingame stuff 100% working but I've never worked with php before and I'm having some trouble getting the [URL="https://github.com/koraktor/steam-condenser-php"]Steam Condenser[/URL] lib to work correctly. I'm sure someone here has done something similar and I would very much appreciate some guidance about the best way to set this up, as I said before I'm a total noob when it comes to php. This is what I have so far based largely on another addon I found that uses php to send rcon commands.
[url]http://pastebin.com/vfWwuRz8[/url]
What is the difference between MySQLoo and TMySQL4?
I am thinking of switching from MySQLoo to TMySQL4, I just wanted to know if it was more efficient on Linux.
TMySQL
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/database/_connecting_with_tmysql.lua.html[/url]
Has a persistent connection, will keep the connection for weeks if you keep your server up that long ( I've tried )
By default uses numerical keys for columns, can use string names by adding QUERY_FLAG_ASSOC after the callback function in the Query call.
Easier to query because the Query function takes these args: ( String query, function callback, number flag ).
MySQLOO
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/database/_connecting_with_mysqloo.lua.html[/url]
Doesn't use persistent connection meaning you need to ensure you're connected before running a query ( unless they recently added this )
By default uses string keys.
Can be more difficult to grasp as each query needs Query, OnSuccess, and OnFailed functions declared before using query.start( ) or something...
I prefer TMySQL over MySQLOO for the persistent connection and simplicity. Both will support complex queries as they go through libmysql so any query you throw at it, even 30 line pivots if you want to, should work as long as they're formatted correctly.
If you use them together as fallback, you can easily do it ( similar to how mine is set up ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/database/_connecting_with_fallbacks_in_place.lua.html[/url]
Also, this function is useful for grabbing row data..
[code]//
// Returns the value regardless of whether or not it uses string / numerical key
//
// Usage: in the onsuccess function there'll be a row / data var, use that. If you process more than 1 row, you'd use a loop..
// i becomes the loop i ( or 1 is used ), and int is the column_name / key.. SELECT blah, bleh means blah is 1, bleh is 2 and
// on * you'd set int to the xTH column you're referencing based on the table structure...
//
// SELECT column_name, column_name2, column_name3 FROM table WHERE x = y LIMIT 1 -- 1 row returned
//
// local _column_name = DB.GetValue( data, 1, 1, "column_name" );
// local _column_name2 = DB.GetValue( data, 1, 2, "column_name2" );
// local _column_name3 = DB.GetValue( data, 1, 3, "column_name3" );
//
// or
//
// SELECT column_name, column_name2, column_name3 FROM table WHERE x = y -- multiple rows returned
//
// for i = 1, table.Count( _row ) do
// local _column_name = DB.GetValue( _row, i, 1, "column_name" );
// local _column_name2 = DB.GetValue( _row, i, 2, "column_name2" );
// local _column_name3 = DB.GetValue( _row, i, 3, "column_name3" );
// end
//
DB = DB || { };
function DB.GetValue( _row, _i, _int, _key )
if ( _row[ _i ][ _int ] ) then
return row[ _i ][ _int ];
else
return row[ _i ][ _key ];
end
end
[/code]
I use that to grab values just in case I forgot the flag, or if TMySQL ever fails ( hasn't except during the 12 to 13 upgrade ) and OO still works ( likely if one fails both will but it's a good option to have ).
I'm making a sent that needs a keep upright applied and I can not for life of me get it to work.
I have tried applying it in "Initialize", "Think" and "SpawnFunction".
I have tried delaying it using timers.
I even tried applying it after the fact using "lua_run".
I know I'm not validating the physobject but these don't work or throw errors.
[code]
constraint.Keepupright(ent, Angle(0,0,0), 0, 999999)
or
constraint.Keepupright(ent, ent:GetPhysicsObject():GetAngles(), 0, 999999)[/code]
What am I doing wrong?
I need help with viewmodel bobbing
I'm trying to make it so the viewmodels bob like they do in CS:S (forward/back, instead of left/right) but I'm having trouble with everything really.
[lua]function SWEP:CalcViewModelView(vm,oldPos,oldAng,pos,ang)
local fraction = 0.25
if LocalPlayer():GetVelocity():Length() > 0 and LocalPlayer():IsOnGround() then
offset = LerpVector(fraction,Vector(0,0,0),(oldAng:Forward() * math.sin(CurTime()*4)) + (oldAng:Up() * math.sin(CurTime()*4)*0.25))
pos = oldPos + offset
elseif offset ~= nil then
LengthyEroticRoleplay = LerpVector(fraction,offset,Vector(0,0,0))
pos = oldPos + LengthyEroticRoleplay
end
ang = oldAng
return pos, ang
end[/lua]
I basically don't want it to stop or start so abruptly. It's sorta doing that, but I wonder if there are better ways or something
[QUOTE=darkwolf0101;46639116]I'm making a sent that needs a keep upright applied and I can not for life of me get it to work.
I have tried applying it in "Initialize", "Think" and "SpawnFunction".
I have tried delaying it using timers.
I even tried applying it after the fact using "lua_run".
I know I'm not validating the physobject but these don't work or throw errors.
[code]
constraint.Keepupright(ent, Angle(0,0,0), 0, 999999)
or
constraint.Keepupright(ent, ent:GetPhysicsObject():GetAngles(), 0, 999999)[/code]
What am I doing wrong?[/QUOTE]
Try using ent:GetAngles() instead
[QUOTE=ROFLBURGER;46639541]Try using ent:GetAngles() instead[/QUOTE]
I tried that but that's not the problem, the keep upright is doing nothing and the sent still tumbles.
What's the best way of having a timer that changes both client/serverside. I assume doing something like SetGlobalInt is going to be expensive.
[QUOTE=darkwolf0101;46639625]I tried that but that's not the problem, the keep upright is doing nothing and the sent still tumbles.[/QUOTE]
I think 999999 is too much. Try 10000.
[QUOTE=bobbleheadbob;46639638]I think 999999 is too much. Try 10000.[/QUOTE]
I copied that from the "properties/keep_upright.lua" file.
Also I just edited that file to remove the "prop_physics" check and it still doesn't work. Is it impossible to constraint a sent with keep upright?
-snip-
[QUOTE=Adzter;46639632]What's the best way of having a timer that changes both client/serverside. I assume doing something like SetGlobalInt is going to be expensive.[/QUOTE]
Just have a start-time that is set, and a duration/delay. Send it via net when you initialize it on the server so it can be sent to client. The server will use Duration - ( CurTime( ) - StartTime ); as the timer delay; that way they'll both execute at the same time.
I did something similar here, but the timer was "hard-coded" so only the start-time was sent: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/sh_hud_countdown.lua.html[/url] -- but the general idea is the same.
Sorry, you need to Log In to post a reply to this thread.