• What do you need help with V4
    639 replies, posted
[QUOTE=Banana Lord.;34966513]because you only ran that script on the client, so the server bit didn't run[/QUOTE] Specifically, where should I put and what should the code be?
lua/autorun
my server been having some problems with random crashes this is what happends in Conlog before crash [QUOTE][03:38] Dropped [LADS]Chew-tah-lue from server (Disconnect by user.) [03:38] Client "[LADS]Chew-tah-lue" connected (70.15.27.134:27005). [03:38] Attempted to create unknown entity type ! [03:38] NULL Ent in GiveNamedItem! [03:38] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_c17/furniturecouch001a.mdl [03:39] Azrim removed prop_physics [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_c17/furniturefireplace001a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:39] xX|HawX|x<STEAM_0:0:24073445> spawned model models/props_junk/popcan01a.mdl [03:40] ^1.:CD:. ^0Giflen<STEAM_0:0:40005235> spawned model models/props_c17/furnituresink001a.mdl [03:40] Entity 783 (class 'prop_physics') reported ENTITY_CHANGE_NONE but 'm_hEffectEntity' changed. [03:40] Entity 1048 (class 'prop_physics') reported ENTITY_CHANGE_NONE but 'm_hEffectEntity' changed. [03:40] Entity 653 (class 'prop_physics') reported ENTITY_CHANGE_NONE but 'm_hEffectEntity' changed. [03:40] attempt to [03:40] Lua Error Dump[/QUOTE] hope u guys can help abit
i need help fixing my rounds.lua... i have most of it right and aif u can optimize it please do i need to have it so that when a 2 players become a class they spawn at a certain position and i set v:SetPos and still didnt work [lua]MAX_ROUNDS = 3 ROUND_TIME = 300 --In Seconds ROUND_TIMELEFT = -1 ROUND_BREAK = 30 --Seconds local CurRound = 0; function ROUND_REACHED() -- Add some event when Current Round Reach the Max Rounds. -- If you have map vote thing, add it. -- If you need to change specific map, just add here. ROUND_MESSEGE( "Max Round reached. Calling Round End Event." ) end function ROUND_MULTIPLAYER() if (#player.GetAll() == 2) then ROUND_MESSEGE( "Starting New Round in few seconds." ) timer.Simple(8,ROUND_WAIT) end; end --hook.Add("PlayerInitialSpawn", "ROUND_MP", ROUND_MULTIPLAYER) function ROUND_END() ROUND_MESSEGE( "New round starting. Prepare." ) timer.Simple(5,ROUND_RESTART) end function ROUND_RESTART() game.CleanUpMap(); -- Reset all map entities. if you don't want it, just delete this line. -- Add some event when new round start. for k, v in ipairs(player.GetAll()) do if v:Team() == TEAM_Boxer then v:SetPos(Vector(12.404461,-11.611498,95.531250)) end; if (MAX_ROUNDS == CurRound) then ROUND_REACHED() end; CurRound = CurRound + 1; end end function ROUND_MESSEGE( say ) for k, v in ipairs(player.GetAll()) do v:PrintMessage(HUD_PRINTTALK, tostring(say)); end; end function ROUND_START() for k, v in pairs(player.GetAll()) do if v:Team() == TEAM_Boxer then v:SetPos(Vector(12.404461,-11.611498,95.531250)) end ROUND_MESSEGE( "Round Starting" ) ROUND_TIMELEFT = ROUND_TIME end end function ROUND_HANDLE() if (ROUND_TIMELEFT == -1) then -- Start the first round ROUND_WAIT() return end ROUND_TIMELEFT = ROUND_TIMELEFT - 1 if (ROUND_TIMELEFT == 0) then if (ROUND_BREAK) then ROUND_START() ROUND_BREAK = false else ROUND_END() ROUND_BREAK = true end end end timer.Create("ROUND_HANDLE", 1, 0, ROUND_HANDLE) function ROUND_WAIT() if (#player.GetAll() <= 1) then ROUND_MESSEGE( "Need More Boxers To Start.") else if (#player.GetAll() == 2) then ROUND_MESSEGE( "Please Wait..." ) timer.Simple(1,ROUND_START) end end end [/lua]
Is there a way to have multi colored text using only one DLabel? I didn't want to use 3 DLabels to do something like: I Like Potatos The "I" in red, the "Like" in white and the "Potatos" in blue
I'm making a small deathmatch gamemode for mostly educational purposes team.SetUp( 1, "Red Team", Color( 255, 99, 71, 255 ) ) team.SetUp( 2, "Blu Team", Color( 65, 105, 255, 255 ) ) That's kind of how my teams are created, but how can I add something so that players can't damage other players on their team? (stop friendly fire) Thanks facepunch :D
[lua]function GM:PlayerShouldTakeDamage( ply, att ) return not (ply:Team() == att:Team()) end[/lua] Adding this to a serverside file will disable friendly fire.
[QUOTE=Nerdeboy;35031314][lua]function GM:PlayerShouldTakeDamage( ply, att ) return not (ply:Team() == att:Team()) end[/lua] Adding this to a serverside file will disable friendly fire.[/QUOTE] I keep getting "[gamemodes\TestDeathmatch\gamemode\init.lua:176] attempt to call method 'team' (a nil value)(Hook: PlayerShouldTakeDamage)" in console when I try to take damage. Also I can't figure out how to remove the default health/suit/ammo gui [IMG]http://screensnapr.com/e/OAXjVL.jpg[/IMG]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index689f.html?title=Gamemode.HUDShouldDraw[/url]
[lua] local tohide = { -- This is a table where the keys are the HUD items to hide ["CHudHealth"] = true, ["CHudBattery"] = true, ["CHudAmmo"] = true, ["CHudSecondaryAmmo"] = true } local function HUDShouldDraw(name) -- This is a local function because all functions should be local unless another file needs to run it if (tohide[name]) then -- If the HUD name is a key in the table return false; -- Return false. end end hook.Add("HUDShouldDraw", "How to: HUD Example HUD hider", HUDShouldDraw) [/lua] Taken from the wiki. Ninja'd :[
My problem is that players on my server are getting an unhandled message for 'notify' clientside: [CODE]usermessage.Hook("notify", function(msg) GAMEMODE:AddNotify(msg:ReadString(), 0, 5); end);[/CODE] serverside: [CODE]function Notify(ply, message) umsg.Start("notify", ply) umsg.String(message) umsg.End() end function PayDay( ply ) Notify( ply, "Payday! You recieved $" .. JobSalaries[ply:Team()] .. "!") end[/CODE] Not sure what the problem is, it works fine for me.
Is it right on Join?
[QUOTE=Deadman123;35044849]Is it right on Join?[/QUOTE] well, if your talking to me, then the timer to get payday starts up on player spawn. [CODE] function GM:PlayerSpawn ( ply ) local steamid = ply:SteamID() playerModel( ply ) timer.Create( steamid .. "_jobtimer", 5, 0, function() PayDay( ply ) end ) end[/CODE]
[QUOTE=Phaesol;35042827]I keep getting "[gamemodes\TestDeathmatch\gamemode\init.lua:176] attempt to call method 'team' (a nil value)(Hook: PlayerShouldTakeDamage)" in console when I try to take damage. [/QUOTE] I'd imagine you're testing this in singleplayer with NPC's or something other than actual players. If it's not a player, more than likely, it doesn't have a team. Since you're just trying to limit damage between two players if they're on the same team, add a check to see if the attacker (att) is a player.
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? This is also my first stool so I probably have made quite a few mistakes..
[QUOTE=PencilOnDesk;35045568]I'd imagine you're testing this in singleplayer with NPC's or something other than actual players. If it's not a player, more than likely, it doesn't have a team. Since you're just trying to limit damage between two players if they're on the same team, add a check to see if the attacker (att) is a player.[/QUOTE] Nope, multiplayer listen server. I jumped and instead of taking fall damage I got that error :x But thanks for the protip ill edit post with results
Does anyone have any knowledge for info_ladder_dismount? I have tried placing this entity all around a func_useableladder but i still can not get the player to "dismount" in the right direction (currently just falling off the ladder).
[QUOTE=Phaesol;35046543]Nope, multiplayer listen server. I jumped and instead of taking fall damage I got that error :x But thanks for the protip ill edit post with results[/QUOTE] The reason is simple. Look back at your error. "Attempt call 'team', a nil value." Now look at the code snippet that was given to you. it uses Player:Team(). Now note that Player:Team() and Player:team() are different. Lua is case-sensitive, and you're using the wrong case.
[QUOTE=DarthTealc;35048168] They all point to the same location as the one that works, but they don't work. I'm really stuck - does anyone have any idea what I am doing wrong?[/QUOTE] It used to work perfectly for retrieving the time of creation of e.g. cache files. But they broke recently and I don't think garry has fixed it in the beta either.
[QUOTE=Gmod4ever;35046681]The reason is simple. Look back at your error. "Attempt call 'team', a nil value." Now look at the code snippet that was given to you. it uses Player:Team(). Now note that Player:Team() and Player:team() are different. Lua is case-sensitive, and you're using the wrong case.[/QUOTE] I aware that lua is case-sensitive and I already tried lower and upper case. Same error each time.
[QUOTE=Gmod4ever;35046681]The reason is simple. Look back at your error. "Attempt call 'team', a nil value." Now look at the code snippet that was given to you. it uses Player:Team(). Now note that Player:Team() and Player:team() are different. Lua is case-sensitive, and you're using the wrong case.[/QUOTE] If you read his post, you'd see it confirmed exactly what I said. He's taking fall damage. Meaning, the attacker (att) is the world, and therefor, does not have a team. You need to check if the attacker (att) is a player.
[QUOTE=DarthTealc;35048168]Just a follow up to that, I said this works: But I've discovered that none of these work: They all point to the same location as the one that works, but they don't work. I'm really stuck - does anyone have any idea what I am doing wrong?[/QUOTE] Try this module (source included): [url]http://gmod.game-host.org/bar/tmp/index.php?dir=modules/gmsv_hsp[/url] [lua] local AllPacks = file.Find("cache/*.dua", true) table.sort(AllPacks, function(a,b) return hsp.Time("cache/"..a) > hsp.Time("cache/"..b) end) local NewPack = AllPacks[1] --Newest [/lua]
This give me [code] bad argument #1 to 'String' <String expected, got nil> Error - Starting new message without ending the old one! [/code] [lua] function AddWantedList(pl) result = sql.Query("SELECT * FROM Suspects") if (result) then umsg.Start("_umsgRecieveWantedList", pl) for k, v in pairs(result) do umsg.String(v[1]) umsg.String(v[2]) end umsg.End() end end hook.Add("PlayerInitialSpawn", "_AddWantedList", AddWantedList) [/lua]
[QUOTE=Persious;35051767]This give me [code] bad argument #1 to 'String' <String expected, got nil> Error - Starting new message without ending the old one! [/code][/QUOTE] Either, v[1] or v[2] (or both) are nil. Check them.
I'm realy stuck here, first time using sql, and I have no clue what the hell I'm doing :P
Do a PrintTable on result to check what the structure of the return table is. I have never used SQLite myself, so I don't know what the return table looks like.
Thank you, finally got it working.
Is it possible somehow using ID, with NOT NULL and AUTO_INCREMENT on MySQLite? I've tried multiple options, but the ID stays at 0
[url]http://www.sqlite.org/faq.html#q1[/url]
Neat, never knew about that. Thanks again.
Sorry, you need to Log In to post a reply to this thread.