[QUOTE=MPan1;48820773]For me when I use your code the vector doesn't face the camera (i.e. I can't see the white cube anywhere)-maybe I didn't say but I didn't just want it in the centre, but also to face the camera (sorry if it works for you, but it doesn't for me).[/QUOTE]
OH you want it like on a globe, where it hovers over where the cube is, i gotchya, i'll work on that then
EDIT:
[code]
function modelpanel:DoClick()
--THIS IS WHAT ACTUALLY MATTERS
local vec = self.Entity:LocalToWorld(Vector(0, 12, 0))
self:SetCamPos(vec + (vec - Vector(0, 0, 0)):GetNormalized() * 40) -- Change 40 to the distance you want the camera to be away from the cube
end
[/code]
That may suit your needs, unless it's imperative that the model rotate and the camera stay in the same spot
[QUOTE=Z0mb1n3;48820823]:snip:[/QUOTE]
THAT WORKS PERFECTLY, but (sorry to keep bothering you):
I think it is imperative for the camera to not move, how would I do this?
how would I get a player's TTT role and color their playermodel?
i actually know how to but the only thing I know is ply:GetAll and that won't work because it doesn't get the specific player's role does it? how could I make it paint only the DET/Traitor
[QUOTE=343N;48824914]how would I get a player's TTT role and color their playermodel?
i actually know how to but the only thing I know is ply:GetAll and that won't work because it doesn't get the specific player's role does it? how could I make it paint only the DET/Traitor[/QUOTE]
Now I'm no scientist, but this would probably work.
[code]for k, ply in ipairs( player.GetAll() ) do
if ply:GetRole() == ROLE_DETECTIVE then
ply:SetPlayerColor( Vector( 0, 0, 1 ) )
elseif ply:GetRole() == ROLE_TRAITOR then
ply:SetPlayerColor( Vector( 1, 0, 0 ) )
else
ply:SetPlayerColor( Vector( 0, 0, 0 ) )
end[/code]
[QUOTE=Zelpa;48825041]Now I'm no scientist, but this would probably work.
[code]for k, ply in ipairs( player.GetAll() ) do
if ply:GetRole() == ROLE_DETECTIVE then
ply:SetPlayerColor( Vector( 0, 0, 1 ) )
elseif ply:GetRole() == ROLE_TRAITOR then
ply:SetPlayerColor( Vector( 1, 0, 0 ) )
else
ply:SetPlayerColor( Vector( 0, 0, 0 ) )
end[/code][/QUOTE]
Add an 'end' to close the if statement, and it should work just fine.
(Also, ipairs isn't necessary for this, pairs will do just fine. But it is pretty much up to preference.)
Hello, so I'm not really sure if this is even possible so I'm gonna go ahead and post it here.
So after installing the "CS:GO Knives SWEPs" addon for Garry's Mod I noticed that many of the skinned knives didn't really match the textures used in CS:GO directly.
I come to think this is something to do with the way CS:GO handles phong/shaders on textures and I was just wondering if this can be replicated in Garry's Mod the same way it is in CSGO?
(Not really sure if GMod's source engine is too outdated for stuff like that either)
If this is indeed possible, would anyone know how to replicate it? (Messing with the phong and phongexponent doesn't give me decent results)
Examples:
CS:GO:
[IMG]http://i.imgur.com/JAxlOnh.jpg[/IMG]
Garry's Mod:
[IMG]https://i.gyazo.com/2b51b0c30e60d9606b77f56ea06a1c39.jpg[/IMG]
[QUOTE=kpjVideo;48826086]Hello, so I'm not really sure if this is even possible so I'm gonna go ahead and post it here.
So after installing the "CS:GO Knives SWEPs" addon for Garry's Mod I noticed that many of the skinned knives didn't really match the textures used in CS:GO directly.
I come to think this is something to do with the way CS:GO handles phong/shaders on textures and I was just wondering if this can be replicated in Garry's Mod the same way it is in CSGO?
(Not really sure if GMod's source engine is too outdated for stuff like that either)
If this is indeed possible, would anyone know how to replicate it? (Messing with the phong and phongexponent doesn't give me decent results)
Examples:
CS:GO:
-snip-
Garry's Mod:
-snip-
[/QUOTE]
CSGO uses different material values that aren't in GMod
And most new CS:GO knives are completely unique, not one is the same.
In CS:GO, the knife texture is offset on every single knife, so every knife appears to be unique.
I am pretty sure this is impossible to replicate in GMod at this time.
is there anyway to get the players playermodel?
[editline]5th October 2015[/editline]
is there anyway to get a current players playermodel?
[editline]5th October 2015[/editline]
nevermind, Entity:GetModel() exists
:snip:
Is there any way to stop a query to the master server started by [URL="http://wiki.garrysmod.com/page/serverlist/Query"]serverlist.Query[/URL]?
Is there any way to do damage to a player using Entity:TakeDamage() without it taking away any armor (so only health damage)? The only way I found was using the DamageType drowning, but that makes the screen turn blue as well..
[QUOTE=syl0r;48830735]Is there any way to do damage to a player using Entity:TakeDamage() without it taking away any armor (so only health damage)? The only way I found was using the DamageType drowning, but that makes the screen turn blue as well..[/QUOTE]
DMG_RADIATION
what could i use to find out if a ragdoll has been identified or not
[QUOTE=343N;48831953]what could i use to find out if a ragdoll has been identified or not[/QUOTE]
Check here in [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/terrortown/gamemode/corpse.lua"]gamemode/corpse.lua[/URL], specifically the CORPSE.GetFound( rag, false ) part.
nevermind, i forgot to edit i got the TTT hook, it's [code]TTTBodyFound (ply, deadply, rag)[/code]
new problem though, i'm trying to get a random player to play a sound, but it's playing it on everyone
[code]hook.Add("TTTEndRound", "endroundvoice", function()
if math.random(0,100) < 100 then
randomply = table.Random(player.GetAll())
randomsound = {
--("vo/npc/male01/question02.wav"),
("vo/npc/male01/question19.wav"),
("vo/npc/male01/question28.wav"),
("vo/npc/male01/question29.wav"),
("vo/npc/male01/question09.wav"),
("vo/npc/male01/question20.wav"),
("vo/npc/male01/question30.wav"),
("vo/npc/male01/question23.wav"),
--("vo/npc/male01/notthemanithought02.wav"),
("vo/npc/male01/gordead_ques10.wav")}
sound = table.Random(randomsound)
if randomply:Alive() then
randomply:EmitSound(sound,400,math.random(80,120),0.5,CHAN_AUTO)
end
end
end)[/code]
[editline]5th October 2015[/editline]
sometimes it plays 2 sounds at the same time
[editline]5th October 2015[/editline]
quick unrelated question, what's the maximum number of characters for a hostname in gmod
edit: it's 48 characters
Hello,
I want to have a function, which is returning a Player's PData serverside and clientside. (must be the same value)
what I have currently:
[CODE]
local meta = FindMetaTable("Player")
function meta:IsDonator()
if SERVER then
util.AddNetworkString("donator")
local donator = tobool(self:GetPData("donator", false))
net.Start("donator")
net.WriteBool(donator)
net.Broadcast()
end
if CLIENT then
net.Receive("donator",function()
local donator = net.ReadBool()
return donator
end )
end
end
[/CODE]
The code is not working, can anybode help me with this? (doing this my first time)
[QUOTE=P4sca1;48832315]Hello,
I want to have a function, which is returning a Player's PData serverside and clientside. (must be the same value)
what I have currently:
[CODE]
local meta = FindMetaTable("Player")
function meta:IsDonator()
if SERVER then
util.AddNetworkString("donator")
local donator = tobool(self:GetPData("donator", false))
net.Start("donator")
net.WriteBool(donator)
net.Broadcast()
end
if CLIENT then
net.Receive("donator",function()
local donator = net.ReadBool()
return donator
end )
end
end
[/CODE]
The code is not working, can anybode help me with this? (doing this my first time)[/QUOTE]
Why not use SetNWBool and and GetNWBool?
[QUOTE=JasonMan34;48832353]Why not use SetNWBool and and GetNWBool?[/QUOTE]
It is the first time I'm doing this, so I thought PData would be the best way.
I never used SetNWBool before and I did not even know, what this is for. Just read the wiki and saw, that this is really useful for what I want to do. I'll try this out, thanks! :)
[QUOTE=AK to Spray;48830466]Is there any way to stop a query to the master server started by [URL="http://wiki.garrysmod.com/page/serverlist/Query"]serverlist.Query[/URL]?[/QUOTE]
Since this has been brought up, does anyone else's internet "mini-crash" after loading the servers?
Lots of pings get blocked by my router I presume, which then shuts down part of my internet for a bit.
Skype seems to work and stuff while this is happening, which is weird.
[editline]5th October 2015[/editline]
[QUOTE=P4sca1;48832364]It is the first time I'm doing this, so I thought PData would be the best way.
I never used SetNWBool before and I did not even know, what this is for. Just read the wiki and saw, that this is really useful for what I want to do. I'll try this out, thanks! :)[/QUOTE]
PData is used for persistent data, allowing the data to be saved and loaded after server restart.
SetNW<> is only set while the entity exists.
[QUOTE=P4sca1;48832364]It is the first time I'm doing this, so I thought PData would be the best way.
I never used SetNWBool before and I did not even know, what this is for. Just read the wiki and saw, that this is really useful for what I want to do. I'll try this out, thanks! :)[/QUOTE]
I mean instead of using net.Whatever just use SetNWBool, it's simpler and cheaper
how would I stop GetLiveKarma from giving clients errors since it's only a serverside variable (but printing a message to the clients?)[code]
hook.Add("TTTPrepareRound", "karmawarning", function()
for k, v in pairs(player.GetAll()) do
if SERVER then karma = v:GetLiveKarma() end
if karma < 650 then
v:ChatPrint("Your karma is low! Play cautiously if you wish to not get karmabanned!")
end
end
end)[/code]
[QUOTE=343N;48832507]how would I stop GetLiveKarma from giving clients errors since it's only a serverside variable (but printing a message to the clients?)[/QUOTE]
Just run that code serverside.
[QUOTE=JasonMan34;48832440]I mean instead of using net.Whatever just use SetNWBool, it's simpler and cheaper[/QUOTE]
What I'm doing now is, when the player donates this code is ran:
[CODE]
Player:SetPData("donator", true)
[/CODE]
Then I have this code on my server:
[CODE]
hook.Add( "PlayerInitialSpawn", "SetDonator", function( ply )
if SERVER then
if tobool(ply:GetPData("donator", false)) == true then
ply:SetNWBool("donator",true)
else
ply:SetNWBool("donator",false)
end
end
end )
local meta = FindMetaTable("Player")
function meta:IsDonator()
return self:GetNWBool("donator", false)
end
[/CODE]
With this code I should be able to use NWBool all the time right?
[QUOTE=Teklatea;48832536]Just run that code serverside.[/QUOTE]
when I run it serverside though it doesn't print anything for me on my client
[editline]5th October 2015[/editline]
nvm i guess i borked something before when i tried it serverside
works fine now
[QUOTE=P4sca1;48832545]What I'm doing now is, when the player donates this code is ran:
[CODE]
Player:SetPData("donator", true)
[/CODE]
Then I have this code on my server:
[CODE]
hook.Add( "PlayerInitialSpawn", "SetDonator", function( ply )
if SERVER then
if tobool(ply:GetPData("donator", false)) == true then
ply:SetNWBool("donator",true)
else
ply:SetNWBool("donator",false)
end
end
end )
local meta = FindMetaTable("Player")
function meta:IsDonator()
return self:GetNWBool("donator", false)
end
[/CODE]
With this code I should be able to use NWBool all the time right?[/QUOTE]
Not exactly.
[CODE]if tobool(ply:GetPData("donator", false)) == true then[/CODE]
Should just be [CODE]if ply:GetPData( "donator", false" ) then[/CODE]
And there's not point in ever running a "== true" check because if true == it returns true. And GetPData will return either what you set it to, or false (On error). Since you set it to true, the check is meaningless
Are there any big differences between net.WriteInt and net.WriteUInt?
[QUOTE=PigeonTroll;48833112]Are there any big differences between net.WriteInt and net.WriteUInt?[/QUOTE]
WriteInt writes signed integer, WriteUInt writes unsigned integer. Look at [URL="https://en.wikipedia.org/wiki/Two's_complement"]two's complement[/URL] to understand the difference (in case you don't know already).
[QUOTE=JasonMan34;48833087]Not exactly.
[CODE]if tobool(ply:GetPData("donator", false)) == true then[/CODE]
Should just be [CODE]if ply:GetPData( "donator", false" ) then[/CODE]
And there's not point in ever running a "== true" check because if true == it returns true. And GetPData will return either what you set it to, or false (On error). Since you set it to true, the check is meaningless[/QUOTE]
Aaaactually, GetPData [B]always[/B] returns a string, regardless of what you set it to. If you set it to boolean true, it will return string "true". Set it to number 12, it will return string "12".
Sorry, you need to Log In to post a reply to this thread.