Does this return a table of valid entites, Becuase everytime I try to use the return table for example v:GetPos() I get a null value error?
[CODE]function findropes(ent)
local t = constraint.FindConstraints(ent,"Rope")
local tt = {}
for k, v in pairs(t) do
if IsValid(v) then
table.insert(tt,v)
end
end
return tt
end[/CODE]
[QUOTE=ExtReMLapin;46872058][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/PlayURL]sound.PlayURL[/url][/QUOTE]
I've tried that but it doesn't play from youtube or sound cloud (unless its just me) tried putting in different links and nothing played...
GetViewModelPosition Runs Slower/Faster depends on client's ping
Do you know what the hell is going on?
300 MS
[t]http://i.imgur.com/2rfIi9C.png[/t]
0 MS
[t]http://i.imgur.com/dVbdRqq.png[/t]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/BlastDamageInfo]util.BlastDamageInfo[/url]
How would i make a CTakeDamageInfo table to use in this function? im trying to make npc's/players dissolve upon death
[QUOTE=AJ10017;46877652][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/BlastDamageInfo]util.BlastDamageInfo[/url]
How would i make a CTakeDamageInfo table to use in this function? im trying to make npc's/players dissolve upon death[/QUOTE]
Pretty straightforward:
[code]
local d = DamageInfo()
d:SetDamage(999)
d:SetDamageType(DMG_DISSOLVE)
util.BlastDamageInfo(d,Entity(1):GetPos(), 500)[/code]
[editline]7th January 2015[/editline]
Altho I'd recommend using Entity.TakeDamageInfo:
[code]
local d = DamageInfo()
d:SetDamage(999)
d:SetDamageType(DMG_DISSOLVE)
Entity(1):TakeDamageInfo(d)[/code]
[QUOTE=Robotboy655;46877706]Pretty straightforward:
[code]
local d = DamageInfo()
d:SetDamage(999)
d:SetDamageType(DMG_DISSOLVE)
util.BlastDamageInfo(d,Entity(1):GetPos(), 500)[/code]
[editline]7th January 2015[/editline]
Altho I'd recommend using Entity.TakeDamageInfo:
[code]
local d = DamageInfo()
d:SetDamage(999)
d:SetDamageType(DMG_DISSOLVE)
Entity(1):TakeDamageInfo(d)[/code][/QUOTE]
Thanks! my main issue was i didnt know what the data type for CTakeDamageInfo was :suicide:
Also why would you recommend the latter? my entity is a projectile that explodes on impact currently using util.BlastDamage. all i need this for is so i can change the damage type to DMG_DISSOLVE
Well, I didn't know you need it as an explosion. I thought you simply want to dissolve an entity.
[editline]7th January 2015[/editline]
I also added some info to [url]http://wiki.garrysmod.com/page/Category:CTakeDamageInfo[/url] & [url]http://wiki.garrysmod.com/page/Entity/TakeDamageInfo[/url]
[QUOTE=Robotboy655;46877754]Well, I didn't know you need it as an explosion. I thought you simply want to dissolve an entity.
[editline]7th January 2015[/editline]
I also added some info to [url]http://wiki.garrysmod.com/page/Category:CTakeDamageInfo[/url] & [url]http://wiki.garrysmod.com/page/Entity/TakeDamageInfo[/url][/QUOTE]
Thanks for adding that to the wiki, i was looking so long for it
I have one more question, a server i am helping with has a custom prop damage script, how would i apply the dissolve effect to props?
The same way?
[editline]7th January 2015[/editline]
Actually I don't know if that will work for props without health.
[QUOTE=Robotboy655;46877858]The same way?
[editline]7th January 2015[/editline]
Actually I don't know if that will work for props without health.[/QUOTE]
Well when the props health goes to 0 they turn completely black and sort of float off until they delete themselves, what i need to do is apply the sparks that come off a players ragdoll to the prop that is destroyed
I think you gotta use the [url=https://developer.valvesoftware.com/wiki/Env_entity_dissolver]env_entity_dissolver[/url] entity.
Why does this only add me to the table?
[CODE]
local trackplys = {
"Bot01",
"Jerry",
}
function trackadd( name )
for k,v in pairs ( player.GetAll() ) do
if string.find( string.lower(v:Nick()), string.lower(name:Nick()) ) then
table.insert(trackplys, v:Nick() )
MsgC( Color( 0, 255, 0 ), "Added ", v:Nick(), " to tracklist...\n" )
end
end
end
concommand.Add( "lonke_tracker_add", trackadd, nil, "Add a tracker" )
[/CODE]
Tested on a server with bots.
[IMG]http://puu.sh/ed1rj/3da7169e70.png[/IMG]
And then printing the table (with MsgC)
[IMG]http://puu.sh/ed1Lp/ba68f286fd.png[/IMG]
Because the first argument of concommand is the player who typed the command. Which is you. The arguments are ( Entity ply, String cmd, Table args, String fullstring )
Get the typed name from the arguments table, then run a check for who has that name using string.find, pretty much like you are currently doing.
Is there anyway i can speed up map switch on my server?
[QUOTE=GreenGold;46880126]Is there anyway i can speed up map switch on my server?[/QUOTE]
Besides downloading stuff, nope.
[QUOTE=Exho;46880478]Besides downloading stuff, nope.[/QUOTE]
Downloading stuff?
You didint understand my question, i have 2 servers they are running same addons and gamemode one is gameserver hosted by nitros other one is windows vps hosted by ovh and nitros server is chaning map so much faster than ovh server regardless of downloads
Server specs would be what is affecting your map change time
Is there any benefit to storing player data with an auto-incrementing unique number as primary key as opposed to using a steamid as primary key?
[QUOTE=zerf;46881277]Is there any benefit to storing player data with an auto-incrementing unique number as primary key as opposed to using a steamid as primary key?[/QUOTE]
Not in Gmod unless you're joining 1000 tables together. In theory, it is faster, because it will be smaller than the SteamID as a key. This is assuming you mean SteamID64. If you mean the fulltext STEAM_0:X:Y SteamID, then don't ever use that as a primary key. The database gods will save you a spot in the lowest ring of hell...
[QUOTE=Revenge282;46881321]Not in Gmod unless you're joining 1000 tables together. In theory, it is faster, because it will be smaller than the SteamID as a key. This is assuming you mean SteamID64. If you mean the fulltext STEAM_0:X:Y SteamID, then don't ever use that as a primary key. The database gods will save you a spot in the lowest ring of hell...[/QUOTE]
There's nothing particularly wrong with using the "fulltext" SteamID as a primary key unless you have millions of rows
Is the only way to get a user's UniqueID to convert it in Lua using:
[code]
util.CRC("gm_" .. ply:SteamID() .. "_gm")
[/code]
I'm ideally needing a way to do it in SQL/PHP.
[QUOTE=Adzter;46883382]Is the only way to get a user's UniqueID to convert it in Lua using:
[code]
util.CRC("gm_" .. ply:SteamID() .. "_gm")
[/code]
I'm ideally needing a way to do it in SQL/PHP.[/QUOTE]
You could try using
[CODE]crc32($steamid)[/CODE]
in PHP to get a uniqueid - if that's what you're asking?
There is no way to get it back afaik
[QUOTE=Adzter;46883382]Is the only way to get a user's UniqueID to convert it in Lua using:
[code]
util.CRC("gm_" .. ply:SteamID() .. "_gm")
[/code]
I'm ideally needing a way to do it in SQL/PHP.[/QUOTE]
[QUOTE=rejax;46883647]You could try using
[CODE]crc32($steamid)[/CODE]
in PHP to get a uniqueid - if that's what you're asking?
There is no way to get it back afaik[/QUOTE]
Check out the [url=http://php.net/manual/en/function.crc32.php]documentation[/url] for the crc32 function. It may return negative values if your machine runs 32bit PHP - that's not really something you'd want.
It's not hard to work around this limitation, though:
[code]
$uniqueid = sprintf("%u", crc32("gm_" . $steamid . "_gm"));
[/code]
[QUOTE=EvacX;46882349]There's nothing particularly wrong with using the "fulltext" SteamID as a primary key unless you have millions of rows[/QUOTE]
There's nothing wrong with it, especially on a Gmod scale, but there's nothing beneficial about it either. Using an integer as a primary key is much more acceptable performance-wise and SteamID64 is just as usable as the SteamID in fulltext.
What coud be causing that ragdols and health station in ttt dont collide with players server has no addons
Hey guys, can anyone explain how [URL="http://wiki.garrysmod.com/page/Entity/ResetSequence"]Entity:ResetSequence[/URL] works?
I want a make a player take a sitting stance
[code]
local stance = ply:GetSequence( )
ply:ResetSequence( ply:LookupSequence( "sit" ) )
[/code]
And then I want them to return to their previous stance
[code]
ply:ResetSequence( stance )
[/code]
But it doesn't work.
Is there some code I can study to understand how it works?
[QUOTE=MuffinZerg;46886227]Hey guys, can anyone explain how [URL="http://wiki.garrysmod.com/page/Entity/ResetSequence"]Entity:ResetSequence[/URL] works?
I want a make a player take a sitting stance
[code]
local stance = ply:GetSequence( )
ply:ResetSequence( ply:LookupSequence( "sit" ) )
[/code]
And then I want them to return to their previous stance
[code]
ply:ResetSequence( stance )
[/code]
But it doesn't work.
Is there some code I can study to understand how it works?[/QUOTE]
The player animations are always reset ( every frame ) in base/gamemode/animations.lua
How can i retreive all the admins on a server and then send a net message to them?
- A user is running a command then i need that command to run on admins?
[code]for id, ply in pairs( player.GetAll() ) do
if ( !ply:IsAdmin() ) then continue end
net.Send(ply)
end[/code]
That but with the important
[lua]if not ply:IsAdmin() then continue end[/lua]
check.
Sorry, you need to Log In to post a reply to this thread.