• What do you need help with? V3
    6,419 replies, posted
Serverside.
[QUOTE=Persious;34994722]Serverside.[/QUOTE] I think he means literally where, what file?
[QUOTE=Banana Lord.;34994689]override _R.Player.Nick [/QUOTE] What do you mean? Where do I place that line and how do I use it? I don't understand what it is on its own.
In my sv_initialize, where everything else works fine, like printing all sv_ files.
[QUOTE=Duskling;34994518]How do I change a players name? Sort of like ply:Name() = "derpface" But when I tried that it didn't work. Is there a special way to do that?[/QUOTE] A friendly advise; [url=http://www.lua.org/pil/]learn basic lua syntax[/url], then come back. It makes it easier for everyone.
[QUOTE=Persious;34994931]In my sv_initialize, where everything else works fine, like printing all sv_ files.[/QUOTE] What's the path to the file from the GMod base folder?
gamemodes/LastStand_Rev2/entities/entities/ I just changed the _Entity to the right location so my code looks like th [lua] _Entity = "gamemodes/" .. LastStand.FolderName .. "/entities/entities/*" print( "\n" ) for k, v in pairs( file.FindDir( _Entity ), true ) do if ( v ) then print( "-> ENTITY: " .. v .. " loaded" ) else print( "-> Could not load " .. v ) end end [/lua]
I use file.FindInLua in my gamemode
The problem is that I only want to find the folders in my entities directory.
[QUOTE=Persious;34996264]The problem is that I only want to find the folders in my entities directory.[/QUOTE] oh I see, one sec [editline]4th March 2012[/editline] [img]http://www.bananatree.im/i/GkIc6WZSAfE.png[/img] works for me? [editline]4th March 2012[/editline] is LastStand.FolderName set at this point? try print(#file.FindDir("gamemodes/"..LastStand.FolderName.."/entities/entities/*"))
Returns 0
[QUOTE=Persious;34996560]Returns 0[/QUOTE] are you sure the path is correct then?
This is the full file: [lua] print( "\n" ) print( "============================================" ) print( "================INITALIZING=================" ) print( "============================================" ) print( "\n" ) _Server = LastStand.FolderName .. "/gamemode/base/server/*.lua" _Client = LastStand.FolderName .. "/gamemode/base/client/*.lua" _Shared = LastStand.FolderName .. "/gamemode/base/shared/*.lua" _Entity = "gamemodes/" .. LastStand.FolderName .. "/entities/entities/*" if !string.find( game.GetMap(), "ls_") then map = "-> MAP: '" .. game.GetMap() .. "' is not supported for this gamemode!" else map = "-> MAP: '" .. game.GetMap() .. "' is supported for this gamemode!" end print(map) print( "\n" ) for k, v in pairs( file.FindDir( _Entity ), true ) do if ( v ) then print( "-> ENTITY: " .. v .. " loaded" ) else print( "-> Could not load " .. v ) end end print( "\n" ) for k, v in pairs( file.FindInLua( _Server ) ) do if ( v ) then include( "server/" .. v ) print( "-> SERVER: " .. v .. " loaded" ) else print( "-> Could not load " .. v ) end end print( "\n" ) for k, v in pairs( file.FindInLua( _Client ) ) do if ( v ) then AddCSLuaFile( "client/" .. v ) print( "-> CLIENT: " .. v .. " loaded" ) else print( "-> Could not load " .. v ) end end print( "\n" ) for k, v in pairs( file.FindInLua( _Shared ) ) do if ( v ) then include( "shared/" .. v ) AddCSLuaFile( "shared/" .. v ) print( "-> SHARED: " .. v .. " loaded" ) else print( "-> Could not load " .. v ) end end print( "\n" ) print( "============================================" ) print( "=================INITALIZED=================" ) print( "============================================" ) print( "\n" ) [/lua] [editline]4th March 2012[/editline] Wait a sec, I think I got it. [editline]4th March 2012[/editline] Nah, didn't work. [editline]4th March 2012[/editline] Found the problem, as I added the ", true" outside of the file.FindDir :P
silly
I know, I know :P
Trying to set a player model at the start of the game, but it doesnt seem to work. It only works if I call JoinCitizen with a console command. [CODE] function GM:PlayerInitialSpawn ( ply ) JoinCitizen( ply ) end [/CODE] [CODE]function JoinCitizen( ply ) ply:KillSilent() ply:SetTeam( TEAM_CITIZEN ) ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. " is now a Citizen!" ) playerModel( ply ) end[/CODE] [CODE]function playerModel ( ply ) local model = ply:GetModel() if ( model != PlayerModels[ply:Team()] ) then ply:SetModel( PlayerModels[ply:Team()] ) print ( PlayerModels[ply:Team()] ) end end [/CODE] Not sure why this is.. Could anybody please help me out?
I need someone to help me figure out how to set the turrets direction to the direction the owner is looking, I still need it to stand on the ground though so it doesnt fall over. Help would be appreciated! [lua] local SpawnPos = tr.HitPos + tr.HitNormal*2 if util.PointContents(SpawnPos) & CONTENTS_SOLID > 0 then return false end local ang = tr.HitNormal:Angle() ang.y = ang.y + Angle(0,LocalPlayer():EyeAngles().y,0)//Wrong local ply = self.Owner local ent = ents.Create("npc_turret_floor") ent:SetPos(SpawnPos) ent:SetAngles(ang) ent:SetOwner(ply) [/lua]
My attempt at changing heads on a model: [img]http://puu.sh/juEY[/img] My code: [lua]local function ChangeHead(ent) if ent:IsPlayer() then local ply = ent function ply.BuildBonePositions() local bone = ply:LookupBone("ValveBiped.Bip01_Head1") local vm = ply:GetBoneMatrix(bone) vm:Scale(Vector(0.01, 0.01, 0.01)) ply:SetBoneMatrix(bone, vm) end local new = ClientsideModel("models/player/urban.mdl") new:SetParent(ply) new:AddEffects(EF_BONEMERGE | EF_NOSHADOW) function new.BuildBonePositions() for i = 1, new:GetBoneCount() do if i != 6 then if new:GetBoneName(i) != "__INVALIDBONE__" then local vm = new:GetBoneMatrix(i) vm:Scale(Vector(0.01, 0.01, 0.01)) new:SetBoneMatrix(i, vm) end end end end end end hook.Add("OnEntityCreated", "ChangeHead", ChangeHead)[/lua] Can someone help me please?
You can't expect that to work on all the models.
[QUOTE=Duskling;34997021]Trying to set a player model at the start of the game, but it doesnt seem to work. It only works if I call JoinCitizen with a console command. [CODE] function GM:PlayerInitialSpawn ( ply ) JoinCitizen( ply ) end [/CODE] [CODE]function JoinCitizen( ply ) ply:KillSilent() ply:SetTeam( TEAM_CITIZEN ) ply:PrintMessage( HUD_PRINTTALK, ply:Nick() .. " is now a Citizen!" ) playerModel( ply ) end[/CODE] [CODE]function playerModel ( ply ) local model = ply:GetModel() if ( model != PlayerModels[ply:Team()] ) then ply:SetModel( PlayerModels[ply:Team()] ) print ( PlayerModels[ply:Team()] ) end end [/CODE] Not sure why this is.. Could anybody please help me out?[/QUOTE] Is this for DarkRP? If it is you shouldn't have to set it on spawn since the default is CITIZEN.
[QUOTE=Arkadi;34999231] [thumb]http://puu.sh/juEY[/thumb] [/QUOTE] bahaha he has underwear now.
I'm making a Pose Parameter stool for the beta but the control panel part isn't working and I can't figure out why. I make it using the faceposer as a base and didn't change anything that should keep it from working. Here is my code: [url]http://pastebin.com/sgmcFMXE[/url] On line 159 there is a debug print like that gets called but nothing still gets added to the control panel. Can anyone see if I'm doing anything wrong? [editline]4th March 2012[/editline] This is my fist stool so I probably have made quite a few mistakes.. Also, I coded this in the beta
[QUOTE=Arkadi;34999231]My attempt at changing heads on a model: [img]http://puu.sh/juEY[/img] My code: [lua]local function ChangeHead(ent) if ent:IsPlayer() then local ply = ent function ply.BuildBonePositions() local bone = ply:LookupBone("ValveBiped.Bip01_Head1") local vm = ply:GetBoneMatrix(bone) vm:Scale(Vector(0.01, 0.01, 0.01)) ply:SetBoneMatrix(bone, vm) end local new = ClientsideModel("models/player/urban.mdl") new:SetParent(ply) new:AddEffects(EF_BONEMERGE | EF_NOSHADOW) function new.BuildBonePositions() for i = 1, new:GetBoneCount() do if i != 6 then if new:GetBoneName(i) != "__INVALIDBONE__" then local vm = new:GetBoneMatrix(i) vm:Scale(Vector(0.01, 0.01, 0.01)) new:SetBoneMatrix(i, vm) end end end end end end hook.Add("OnEntityCreated", "ChangeHead", ChangeHead)[/lua] Can someone help me please?[/QUOTE] [lua]local function ChangeHead(ent) if ent:IsPlayer() then local ply = ent function ply:BuildBonePositions() local bone = self:LookupBone("ValveBiped.Bip01_Head1") local vm = self:GetBoneMatrix(bone) vm:Scale(Vector(0.01, 0.01, 0.01)) self:SetBoneMatrix(bone, vm) end local new = ClientsideModel("models/player/urban.mdl") new:SetParent(ply) new:AddEffects(EF_BONEMERGE | EF_NOSHADOW) function new:BuildBonePositions() for i = 0, self:GetBoneCount()-1 do if self:GetBoneName(i) == "ValveBiped.Bip01_Head1" then local vm = self:GetBoneMatrix(i) vm:Scale(Vector(100, 100, 100)) -- 1/0.01 self:SetBoneMatrix(i, vm) elseif self:GetBoneName(i) != "__INVALIDBONE__" then local vm = self:GetBoneMatrix(i) vm:Scale(Vector(0.01, 0.01, 0.01)) self:SetBoneMatrix(i, vm) end end end end end hook.Add("OnEntityCreated", "ChangeHead", ChangeHead)[/lua]
Does a STool has self.Owner function? I'm trying to test it with this code: [lua]function TOOL:RightClick(tr) MsgN("self.Owner - "..tostring(self.Owner)) end[/lua] And it returns [code]self.Owner - [NULL Entity][/code] GMod 13 btw
[QUOTE=aurum481;35005278]Does a STool has self.Owner function? I'm trying to test it with this code: [lua]function TOOL:RightClick(tr) MsgN("self.Owner - "..tostring(self.Owner)) end[/lua] And it returns [code]self.Owner - [NULL Entity][/code] GMod 13 btw[/QUOTE] [lua]self:GetOwner()[/lua]
You know what? I tried loading up that code in multiplayer and it returns [code]self.Owner - Player [1][Rimbas4.lt][/code] Is that a bug in singleplayer? Gonna try your suggestion now. Weird... [lua]function TOOL:RightClick(tr) MsgN("self.Owner - "..tostring(self.Owner).." ; self:GetOwner() - "..tostring(self:GetOwner()) ) end[/lua] [code]self.Owner - [NULL Entity] ; self:GetOwner() - Player [1][Rimbas4.lt] [[SERVERSIDE]] self.Owner - Player [1][Rimbas4.lt] ; self:GetOwner() - Player [1][Rimbas4.lt] [[CLIENTSIDE]][/code] self.Owner serverside returns null entity. Okay, resolved my problem.
Hi, is there anyway to make the players current weapon's icon appear on his hud? By icon i mean the image displayed for the weapon on the weapon selection.
[QUOTE=aurum481;35005349]You know what? I tried loading up that code in multiplayer and it returns [code]self.Owner - Player [1][Rimbas4.lt][/code] Is that a bug in singleplayer? Gonna try your suggestion now. Weird... [lua]function TOOL:RightClick(tr) MsgN("self.Owner - "..tostring(self.Owner).." ; self:GetOwner() - "..tostring(self:GetOwner()) ) end[/lua] [code]self.Owner - [NULL Entity] ; self:GetOwner() - Player [1][Rimbas4.lt] [[SERVERSIDE]] self.Owner - Player [1][Rimbas4.lt] ; self:GetOwner() - Player [1][Rimbas4.lt] [[CLIENTSIDE]][/code] self.Owner serverside returns null entity. Okay, resolved my problem.[/QUOTE] I thought self.Owner and self.Weapon were deprecated years ago. Garry just kept them around so things wouldn't break.
[QUOTE=Tom083;35006474]Hi, is there anyway to make the players current weapon's icon appear on his hud? By icon i mean the image displayed for the weapon on the weapon selection.[/QUOTE] That depends. Is it a SWEP or one of the default weapons?
[QUOTE=Nerdeboy;35009857]That depends. Is it a SWEP or one of the default weapons?[/QUOTE] I was hoping to do it for both. But i think il start with the default ones for now.
Sorry, you need to Log In to post a reply to this thread.