• What do you need help with? V3
    6,419 replies, posted
-snip, stupid invisible spaces that cause errors-
Posted this by accident somewhere else. When I spawn my NPC I get this spammed into console: [lua] [ERROR] lua/includes/modules/ai_task.lua:91: bad argument #1 to 'StartEngineTask' (number expected, got nil) 1. StartEngineTask - [C]:-1 2. Start - lua/includes/modules/ai_task.lua:91 3. StartTask - gamemodes/base/entities/entities/base_ai/schedules.lua:137 4. SetTask - gamemodes/base/entities/entities/base_ai/schedules.lua:104 5. NextTask - gamemodes/base/entities/entities/base_ai/schedules.lua:127 6. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:75 7. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22 [ERROR] lua/includes/modules/ai_task.lua:117: bad argument #1 to 'RunEngineTask' (number expected, got nil) 1. RunEngineTask - [C]:-1 2. Run - lua/includes/modules/ai_task.lua:117 3. RunTask - gamemodes/base/entities/entities/base_ai/schedules.lua:148 4. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:71 5. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22 [/lua] My question basically is, what is changed?
*Snip think I got it*
[lua]hook.Add("DoPlayerDeath", "ShowKiller", function(victim, attacker) if attacker:IsPlayer() && attacker:IsRole(ROLE_TRAITOR) then victim:chat.AddText(Color(255,0,0), "You have been killed by a traitor.") elseif attacker:IsPlayer() && attacker:IsRole(ROLE_INNOCENT) then victim:chat.AddText(Color(0,0,255),"You have been killed by "..attacker:Nick()..". He was an innocent.") elseif not attacker:IsPlayer() then victim:chat.AddText(Color(0,255,0), "You were not killed by a player.") end end)[/lua] Why doesn't this work? For some reason it gives this error [ERROR] lua/autorun/client/tttkiller.lua:3: function arguments expected near '.' 1. unknown - lua/autorun/client/tttkiller.lua:0
[QUOTE=Weapon317;38619155]Posted this by accident somewhere else. When I spawn my NPC I get this spammed into console: [lua] [ERROR] lua/includes/modules/ai_task.lua:91: bad argument #1 to 'StartEngineTask' (number expected, got nil) 1. StartEngineTask - [C]:-1 2. Start - lua/includes/modules/ai_task.lua:91 3. StartTask - gamemodes/base/entities/entities/base_ai/schedules.lua:137 4. SetTask - gamemodes/base/entities/entities/base_ai/schedules.lua:104 5. NextTask - gamemodes/base/entities/entities/base_ai/schedules.lua:127 6. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:75 7. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22 [ERROR] lua/includes/modules/ai_task.lua:117: bad argument #1 to 'RunEngineTask' (number expected, got nil) 1. RunEngineTask - [C]:-1 2. Run - lua/includes/modules/ai_task.lua:117 3. RunTask - gamemodes/base/entities/entities/base_ai/schedules.lua:148 4. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:71 5. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22 [/lua] My question basically is, what is changed?[/QUOTE] That's actually a bug, ai.GetTaskID returning nil no matter what. Y'know, I don't think anyone's put in a proper bug report, you should post about it in the Developments section
[QUOTE=Kicks38;38619689][lua]hook.Add("DoPlayerDeath", "ShowKiller", function(victim, attacker) if attacker:IsPlayer() && attacker:IsRole(ROLE_TRAITOR) then victim:chat.AddText(Color(255,0,0), "You have been killed by a traitor.") elseif attacker:IsPlayer() && attacker:IsRole(ROLE_INNOCENT) then victim:chat.AddText(Color(0,0,255),"You have been killed by "..attacker:Nick()..". He was an innocent.") elseif not attacker:IsPlayer() then victim:chat.AddText(Color(0,255,0), "You were not killed by a player.") end end)[/lua] Why doesn't this work? For some reason it gives this error [ERROR] lua/autorun/client/tttkiller.lua:3: function arguments expected near '.' 1. unknown - lua/autorun/client/tttkiller.lua:0[/QUOTE] If you want the victim to see that, you have to use victim:SendLua("chat.AddText(Color(255, 0, 0), \"You have been killed by "..attacker:Name()..". blah blah\""). You might want to use a net message instead since the attacker's name could lead to problems with escaping and being abused.
[QUOTE=Kicks38;38619689][lua]hook.Add("DoPlayerDeath", "ShowKiller", function(victim, attacker) if attacker:IsPlayer() && attacker:IsRole(ROLE_TRAITOR) then victim:chat.AddText(Color(255,0,0), "You have been killed by a traitor.") elseif attacker:IsPlayer() && attacker:IsRole(ROLE_INNOCENT) then victim:chat.AddText(Color(0,0,255),"You have been killed by "..attacker:Nick()..". He was an innocent.") elseif not attacker:IsPlayer() then victim:chat.AddText(Color(0,255,0), "You were not killed by a player.") end end)[/lua] Why doesn't this work? For some reason it gives this error [ERROR] lua/autorun/client/tttkiller.lua:3: function arguments expected near '.' 1. unknown - lua/autorun/client/tttkiller.lua:0[/QUOTE] [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexebff.html[/url] [code]victim:PrintMessage(HUD_PRINTTALK,killer:Nick().." just killed yo ass!")[/code]
Untested, but something like this would probably work. [code] //Mind the shittiness. if( SERVER ) then function AddColoredText( pl, col, msg ) umsg.Start( "sendtext", pl ); umsg.String( msg ); umsg.Short( col.r ); umsg.Short( col.g ); umsg.Short( col.b ); umsg.End(); end hook.Add( "DoPlayerDeath", "ShowKiller", function( victim, attacker ) if( attacker && attacker:IsPlayer() && attacker:IsRole( ROLE_TRAITOR ) ) then AddColoredText( victim, Color( 255, 0, 0 ), "You have been killed by a traitor." ); end if( attacker && attacker:IsPlayer() && attacker:IsRole( ROLE_INNOCENT ) ) then AddColoredText( victim, Color( 0, 0, 255 ), "You have been killed by "..attacker:Nick()..". He was an innocent." ); end if( attacker && !attacker:IsPlayer() ) then AddColoredText( victim, Color( 0, 255, 0 ), "You weren't killed by a player." ); end end ); end if( CLIENT ) then usermessage.Hook( "sendtext", function( um ) local msg = um:ReadString(); local col = Color( um:ReadShort(), um:ReadShort(), um:ReadShort(), 255 ); chat.AddText( col, msg ); end ); end [/code]
why are you sending a short (4 bytes) instead of a char (2 bytes)? just send the channel value (r, g, b) minus 128 (or something i forget what to minus) its nothing significant, i mean its not going to lag because you send 6 extra bytes. [del]also the net library has net.WriteByte which writes a value between 0 and 255 which is perfect for colors.[/del] apparently net.Write/ReadByte has been removed. heres the code for it if you want to use it. [lua] function net.WriteByte(int) net.WriteUInt(int, 8); end function net.ReadByte() return net.ReadUInt(8); end [/lua]
[QUOTE=amkoc;38620394]That's actually a bug, ai.GetTaskID returning nil no matter what. Y'know, I don't think anyone's put in a proper bug report, you should post about it in the Developments section[/QUOTE] Thanks, I posted it in the development section.
Is there a function to get the IP address of a server?
[QUOTE=_NewBee;38626094]Is there a function to get the IP address of a server?[/QUOTE] Can't you get it from [URL="http://wiki.garrysmod.com/page/Libraries/gameevent/Listen"]gameevent.Listen("server_cvar")[/URL]? it's one of them I remember doing her. Then store her in a table/string.
[QUOTE=NinjaS;38626919]Can't you get it from [URL="http://wiki.garrysmod.com/page/Libraries/gameevent/Listen"]gameevent.Listen("server_cvar")[/URL]? it's one of them I remember doing her. Then store her in a table/string.[/QUOTE] If it's a cvar, can't you just use GetConVar?
[QUOTE=Drakehawke;38627151]If it's a cvar, can't you just use GetConVar?[/QUOTE] True but someone said you need to use binary ect to convert it, he might be talking about client side or smth.
[QUOTE=NinjaS;38627324]True but someone said you need to use binary ect to convert it, he might be talking about client side or smth.[/QUOTE] So do show me how you do this using the server_cvar game event?
Does anyone have a function that'll spawn a prop at a random location, out of sight of the player spawns, but ensure it doesn't end up in a wall?
[QUOTE=Drakehawke;38627401]So do show me how you do this using the server_cvar game event?[/QUOTE] I don't remember what game event it's but it's one of them I said I used. game->GetIP(); is another way using a module
[lua] function game.GetIP() local hostip = GetConVarString( "hostip" ) -- GetConVarNumber is inaccurate hostip = tonumber( hostip ) local ip = {} ip[ 1 ] = bit.rshift( bit.band( hostip, 0xFF000000 ), 24 ) ip[ 2 ] = bit.rshift( bit.band( hostip, 0x00FF0000 ), 16 ) ip[ 3 ] = bit.rshift( bit.band( hostip, 0x0000FF00 ), 8 ) ip[ 4 ] = bit.band( hostip, 0x000000FF ) return table.concat( ip, "." ) end[/lua] If you need it clientside just network it, no big deal since it's never going to change.
Does anyone have a solution to this problem for GM13? Ignore the missing models. [t]http://puu.sh/1vpdJ[/t]
[QUOTE=amkoc;38628321]Does anyone have a function that'll spawn a prop at a random location, out of sight of the player spawns, but ensure it doesn't end up in a wall?[/QUOTE] it'd probably be best to make a bunch of nodes on the map that the props could spawn at. info_node would work well, you could just place them all around where you would want possible props to spawn. after that, get the table using: [CODE] local propspawns = ents.FindByClass("info_node") [/CODE] and then spawn it at one of the random locations that isn't visible using this: [CODE] local pos = table.Random(propspawns) if pos.visible == false then prop = ents.Create("prop_dynamic") prop:SetModel("path/to/model/here") prop:SetPos(pos:GetPos()) prop:Spawn() end [/CODE] or something similar
[QUOTE=_Undefined;38630741]Does anyone have a solution to this problem for GM13? Ignore the missing models. [t]http://puu.sh/1vpdJ[/t][/QUOTE] Override the paint function and wrap it in calls to [url=http://wiki.garrysmod.com/page/Libraries/render/SetScissorRect]render.SetScissorRect[/url], you can find the original paint function [url=http://glua.me/bin/?path=/lua/vgui/dmodelpanel.lua]here[/url].
[QUOTE=cabbiethefirst;38630830]it'd probably be best to make a bunch of nodes on the map that the props could spawn at. info_node would work well, you could just place them all around where you would want possible props to spawn. after that, get the table using: [CODE] local propspawns = ents.FindByClass("info_node") [/CODE] and then spawn it at one of the random locations that isn't visible using this: [CODE] local pos = table.Random(propspawns) if pos.visible == false then prop = ents.Create("prop_dynamic") prop:SetModel("path/to/model/here") prop:SetPos(pos:GetPos()) prop:Spawn() end [/CODE] or something similar[/QUOTE] Thanks, but most of the maps I'd use it on won't have nodegraphs and I'd rather not have to make one every time I want to use this.
I have a spawnlist in the lua/autorun folder, but it isn't showing up ingame. Here's my lua file, could someone please tell me what noob-ish mistake I'm making? [code] local Category = "Okibi's NPCs" local NPC = { Name = "Hybrid Hunter", Class = "sent_hhunter", KeyValues = { citizentype = 4 }, Category = Category } list.Set( "NPC", "sent_hhunter", NPC ) [/code]
[QUOTE=Drakehawke;38629185]-code- If you need it clientside just network it, no big deal since it's never going to change.[/QUOTE] This is pretty much how I've been doing it
i dont have code to display, but I can't for the life of me make a script where it deletes props in spawn from [lua]local getspawnpoints = { "info_player_counterterrorist", "info_player_terrorist", "info_player_start" }[/lua] i can do it from a specific vector position but not from these
Not sure if lua related.... but users keep getting disconnected from my server, ex: [code] Dropped JR from server (ProcessUsercmds: Overflowed reading usercmd data (check sending and receiving code for mismatches)! [/code] Disconnected as in they join and get disconnected instantly.
Ugh, kinda stuck now. Deathrun maps have CS:S weapons such as weapon_knife and weapon_deagle. Do i really have to recreate them all or is there a trick to somehow fix this?
Guyes, ideas why entities don't want their render bounds set? (they appears at vector_origin and their angles are always 0 0 0)
If you are using SetRenderOrigin/Angles then you need to call SetupBones between those calls and the DrawModel call.
Thanks, it worked.
Sorry, you need to Log In to post a reply to this thread.