• What do you need help with V4
    639 replies, posted
.deleted.
PlayerInitialSpawn is a serverside hook and it looks like you're running this clientside. Try changing PlayerInitialSpawn to Initialize.
.deleted.
[QUOTE=Hoffa1337;35553828][lua] hook.Add("PlayerInitialSpawn", "MyInitSpawnFunc", function( ply ) ply:RunConsoleCommand( "my command", "1" ) end ) [/lua][/QUOTE] it's objPl:ConCommand, not objPl:RunConsoleCommand
does anyone has some good tutorials at derma? like making an custom derma element that scales to screen resolution etc ,Becouse i really get messed up whatever i try to even just make a simple screen with it
is there any way to change a weapons view and world model within the weapons code?
[code] self.Owner:GetViewModel():SetModel() [/code] and for world I think [code] self:SetModel() or self.Entity:SetModel() [/code]
[QUOTE=werewolf0020;35560312]does anyone has some good tutorials at derma? like making an custom derma element that scales to screen resolution etc ,Becouse i really get messed up whatever i try to even just make a simple screen with it[/QUOTE] Just make your panel heights and widths scale off of ScrH() and ScrW() respectively. Use decimal scalars for percentages of the screen. I.e if you want a panels with to be 45% of the screen size you would do panel:SetWide(ScrW() * .45) panel:SetTall(ScrH() * .45)
Oh so i could do the same in a DFrame?
Is it possible to blend 2 animations together?
I am having problem with a gamemode. [CODE]GM.ScoreboardFaces[/CODE] is defined at "gamemode/sv_setup.lua" and being used with "entities/ent_scoreboard/init.lua" and it says that its a nil value (because it thinks it wasn't defined) and it happens with many other values. The gamemode works in GMod 12 but not in GMod 13 because of this shitty bug...
My friend needs help with something. He's doing some gamemode stuff and he's a litttle stuck on this one; In this gamemode, there are numorous refrences to AddChatCommand however when he runs this gamemode in the beta he gets the error "Attempt to call global "AddChatCommand" (a nil value) " and he cannot find a function in this gamemode related to "AddChatCommand" however he knows AddChatCommand is also in DarkRP's scripting... What happened to AddChatCommand? (This gamemode was working before GM13)
Is there a certain way you need to define ammo or anything for SWEPs? Or can I just "SWEP.Primary.Ammo = 'fruit'"
The text is based on ammo type names in the engine ( which can't really be expanded on that much - there's only four or so indices available in the array from the public code ). Any non-valid type is left to the coder to handle. I could be wrong, but this is how it looked the last time I dug around for that.
[QUOTE=Kogitsune;35574500]The text is based on ammo type names in the engine ( which can't really be expanded on that much - there's only four or so indices available in the array from the public code ). Any non-valid type is left to the coder to handle. I could be wrong, but this is how it looked the last time I dug around for that.[/QUOTE] alright, thanks
So i am trying to fix up base wars but there is a problem, everytime i goto use the drug refinery, gun factory or any of those i get [LmaoLlamaBaseWars\gamemode\physables.lua:178] attempt to call method 'CanRefine' (a nil value) error. [lua] function ccSetRefineryMode( ply, cmd, args ) if (args[1]==nil || args[2] == nil) then return end mode = tostring(args[2]) if !ValidEntity(ents.GetByIndex(args[1])) || (mode!="money" && mode!="offense" && mode!="defense" && mode!="weapmod" && mode!="eject" && mode!="uber") then return end local vault = ents.GetByIndex(args[1]) if (vault:GetClass()!="drugfactory" || ply:GetPos():Distance(vault:GetPos())>300) then return end local ref = vault:CanRefine(mode,ply) if (ref==true) then vault:SetMode(mode) else Notify(ply,4,3,ref) end umsg.Start( "killdrugfactorygui", ply ); umsg.Short( args[1] ) umsg.End() end concommand.Add( "setrefinerymode", ccSetRefineryMode ); [/lua] That is the code.
is CanRefine defined anywhere
[QUOTE=Banana Lord.;35580333]is CanRefine defined anywhere[/QUOTE] I'm not sure havn't had a proper look, sorry. But if it isn't how would i define it?
[QUOTE=silenced deat;35585596]I'm not sure havn't had a proper look, sorry. But if it isn't how would i define it?[/QUOTE] function _R.Entity:CanRefine() end
[QUOTE=JustSoFaded;35586728]function _R.Entity:CanRefine() end[/QUOTE] Thanks! that fixed it :)
So, i'm trying to fix Silverlan's TF2 sweps, and the main problem is this: [code][addons\team-fortress\lua\autorun\tf_modulus_ammo_ext.lua:35] attempt to call method 'SetCustomAmmo' (a nil value)` [addons\team-fortress\lua\weapons\base_swep_tf_handgun\cl_init.lua:39] attempt to call method 'GetCustomAmmo' (a nil value) C[/code] Is this caused by the command itself no longer existing in GMod, or no numeric value being acossiated with the command? Isolating the problematic commands: [code] //---------- Ammo Extension local meta = FindMetaTable( "Player" ); if( !meta ) then return; end /*------------------------------------ GetCustomAmmo ------------------------------------*/ function meta:GetCustomAmmo( name, 200 ) return self:GetNetworkedInt( "ammo_" .. name ); end /*------------------------------------ SetCustomAmmo ------------------------------------*/ function meta:SetCustomAmmo( name, 200 ) return self:SetNetworkedInt( "ammo_" .. name, num ); end /*------------------------------------ AddCustomAmmo ------------------------------------*/ function meta:AddCustomAmmo( name, 200 ) return self:SetCustomAmmo( name, self:GetCustomAmmo( name ) + num ); end [/code]
Why is the second argument a number?
I do not know.
Change it to "num".
Same problem.
I dunno, you didn't even tell us which line is line 35.
[QUOTE=Drsalvador;35588553]So, i'm trying to fix Silverlan's TF2 sweps, and the main problem is this: [code][addons\team-fortress\lua\autorun\tf_modulus_ammo_ext.lua:35] attempt to call method 'SetCustomAmmo' (a nil value)` [addons\team-fortress\lua\weapons\base_swep_tf_handgun\cl_init.lua:39] attempt to call method 'GetCustomAmmo' (a nil value) C[/code] Is this caused by the command itself no longer existing in GMod, or no numeric value being acossiated with the command? Isolating the problematic commands: [code] //---------- Ammo Extension local meta = FindMetaTable( "Player" ); if( !meta ) then return; end /*------------------------------------ GetCustomAmmo ------------------------------------*/ function meta:GetCustomAmmo( name, 200 ) return self:GetNetworkedInt( "ammo_" .. name ); end /*------------------------------------ SetCustomAmmo ------------------------------------*/ function meta:SetCustomAmmo( name, 200 ) return self:SetNetworkedInt( "ammo_" .. name, num ); end /*------------------------------------ AddCustomAmmo ------------------------------------*/ function meta:AddCustomAmmo( name, 200 ) return self:SetCustomAmmo( name, self:GetCustomAmmo( name ) + num ); end [/code][/QUOTE] is that file even included?
I'm trying to make an imperial guard and traitor guard npc. I downloaded [url=http://www.garrysmod.org/downloads/?a=view&id=102812]this[/url] and modified it. I can spawn both, and whilst the traitor guardsman attempts to kill me, he ignores the imperial guardsman. I had thought adding self.Monsters = {"npc_traitor_guardsman"} would resolve it, but it doesn't change anything. There's also a number of other issues with this npc, so I wonder if it wouldn't be simpler to just base it on a citizen npc with different skins. But in either case, how do I make them shoot each other?
[QUOTE=QwertySecond;35606964]I'm trying to make an imperial guard and traitor guard npc. I downloaded [url=http://www.garrysmod.org/downloads/?a=view&id=102812]this[/url] and modified it. I can spawn both, and whilst the traitor guardsman attempts to kill me, he ignores the imperial guardsman. I had thought adding self.Monsters = {"npc_traitor_guardsman"} would resolve it, but it doesn't change anything. There's also a number of other issues with this npc, so I wonder if it wouldn't be simpler to just base it on a citizen npc with different skins. But in either case, how do I make them shoot each other?[/QUOTE] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index82ed.html?title=NPC.AddRelationship[/url]
So i am moving perp over to rp_evocity_v2d and i am having problems all of a sudden after i changed the fireman,police,swat and SS car spawns. The error is: [gamemodes\perp3\gamemode\sv_modules\job_fireman.lua:34] attempt to call method 'RemoveCar' (a nil value) [gamemodes\perp3\gamemode\sv_modules\job_fireman.lua:84] attempt to call field 'SpawnVehicle' (a nil value) The codefrom line 34 to 86 [lua] Player:RemoveCar(); for k, v in pairs(player.GetAll()) do umsg.Start("removebadid", Player) umsg.Short(Player:GetCarUsed()); // Fuel Left umsg.End() end GAMEMODE.JobEquips[TEAM_FIREMAN](Player); Player.JobModel = JOB_MODELS[TEAM_FIREMAN][Player:GetFace()] or JOB_MODELS[TEAM_FIREMAN][1]; Player:SetModel(Player.JobModel); Player:StripMains(); end concommand.Add("perp_f_j", GM.Fireman_Join); function GM.Fireman_Quit ( Player ) if (!Player:NearNPC(12)) then return; end GAMEMODE.Fireman_Leave(Player); end concommand.Add("perp_f_q", GM.Fireman_Quit); function GM.Fireman_Leave ( Player ) Player:SetTeam(TEAM_CITIZEN); Player:StripWeapon("weapon_perp_fire_axe"); Player:StripWeapon("weapon_perp_fire_hose"); Player:StripWeapon("weapon_perp_fire_extinguisher"); Player:RemoveCar(); Player:SetCarUsed(0); Player.JobModel = nil; Player:SetModel(Player.PlayerModel); Player:EquipMains() end function GM.Fireman_SpawnCar ( Player ) if (Player:Team() != TEAM_FIREMAN) then return; end if (!Player:NearNPC(12)) then return; end local numFireCars = 0; for k, v in pairs(ents.FindByClass("prop_vehicle_jeep")) do if (v.vehicleTable && v.vehicleTable.RequiredClass == TEAM_FIREMAN && v:GetNetworkedEntity("owner", nil) != Player) then numFireCars = numFireCars + 1; end end if (numFireCars >= GAMEMODE.MaxFireTrucks) then return; end GAMEMODE.SpawnVehicle(Player, "y", {1, 1, 0, 0}) end concommand.Add("perp_f_c", GM.Fireman_SpawnCar); [/lua]
Sorry, you need to Log In to post a reply to this thread.