Why everyone wants things coded for them? they cant just open a file and change a few lines?
[QUOTE=werewolf0020;30544516]Why everyone wants things coded for them? they cant just open a file and change a few lines?[/QUOTE]
I dont think i can make a printer by editing some few lines.
And i dont know how to make teams.
Then start learning. Experience is the best teacher.
Only ask people for help when you need it, not because you want something and can't be arsed to do the work.
I see that in DarkRP server,its was your's?
So I'm attempting to modify this to work with my TTT server, basically what I am trying to do is make it so that when a traitor kills an innocent they get 10 points, when an innocent kills a traitor they get 10 points, and when a traitor kills a traitor they lose 50 points. I also wanted to make it so that everyone got 7 points at the beginning of a round. Here's the code that I have, which I thought should work (I didn't know any lua before this so I made this off of the wiki and reading other code). It doesn't work at all, sadly. Anyone mind helping me out a bit?
[lua]
hook.Add( "TTTBeginRound", "RoundStartPoints", function()
ply:PS_GivePoints( 7, "Round start" )
evolve:Notify( ply, evolve.colors.red, "You were awarded 7 points at the start of the round" )
end)
hook.Add( "PlayerDeath", "PointsForKill", function( victim, weapon, killer)
if killer:IsTraitor and not victim:IsTraitor then
killer:PS_GivePoints( 10, victim.."was killed by"..killer )
evolve:Notify( ply, evolve.colors.red, "You were awarded 10 points for killing an innocent" )
elseif victim:IsTraitor and not killer:IsTraitor then
killer:PS_GivePoints( 10, victim.."[TRAITOR] was killed by"..killer.."[Inno.]" )
evolve:Notify( ply, evolve.colors.red, "You were awarded 10 points for killing a traitor" )
elseif victim:IsTraitor and killer:IsTraitor then
killer:PS_TakePoints( 50, victim.."[TRAITOR] was team killed by"..killer.."[TRAITOR]" )
evolve:Notify( ply, evolve.colors.red, "You had 50 points taken from you for killing a fellow Traitor" )
else
evolve:Notify( ply, evolve.colors.red, "You killed an innocent!" )
end
end)
[/lua]
Also I added this to the autorun/pointshop.lua file.
[code] include("sv_ttt_points.lua") [/code]
Thanks in advance, sorry if my code is terrible >.< like I said I attempted to learn lua for this.
EDIT: Forgot to mention, I have Evolve running as well.
[QUOTE=IrishSteel;31057666]So I'm attempting to modify this to work with my TTT server, basically what I am trying to do is make it so that when a traitor kills an innocent they get 10 points, when an innocent kills a traitor they get 10 points, and when a traitor kills a traitor they lose 50 points. I also wanted to make it so that everyone got 7 points at the beginning of a round. Here's the code that I have, which I thought should work (I didn't know any lua before this so I made this off of the wiki and reading other code). It doesn't work at all, sadly. Anyone mind helping me out a bit?
[/QUOTE]
[LUA]
hook.Add( "TTTBeginRound", "RoundStartPoints", function()
for _,ply in ipairs( player.GetAll() ) do
ply:PS_GivePoints( 7, "Round start" )
evolve:Notify( ply, evolve.colors.red, "You were awarded 7 points at the start of the round" )
end
end )
hook.Add( "PlayerDeath", "PointsForKill", function( victim, weapon, killer)
if( ValidEntity( killer ) and ValidEntity( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
if( killer:IsTraitor() and not victim:IsTraitor() ) then
killer:PS_GivePoints( 10, victim:Nick().." was killed by "..killer:Nick() )
evolve:Notify( killer, evolve.colors.red, "You were awarded 10 points for killing an innocent" )
elseif( victim:IsTraitor() and not killer:IsTraitor() ) then
killer:PS_GivePoints( 10, victim:Nick().."[TRAITOR] was killed by "..killer:Nick().."[Inno.]" )
evolve:Notify( killer, evolve.colors.red, "You were awarded 10 points for killing a traitor" )
elseif( victim:IsTraitor() and killer:IsTraitor() ) then
killer:PS_TakePoints( 50, victim:Nick().."[TRAITOR] was team killed by "..killer:Nick().."[TRAITOR]" )
evolve:Notify( killer, evolve.colors.red, "You had 50 points taken from you for killing a fellow Traitor" )
else
evolve:Notify( killer, evolve.colors.red, "You killed an innocent!" )
end
end
end
end )
[/LUA]
Try that
[QUOTE=Scooby;31060499][LUA]
hook.Add( "TTTBeginRound", "RoundStartPoints", function()
for _,ply in ipairs( player.GetAll() ) do
ply:PS_GivePoints( 7, "Round start" )
evolve:Notify( ply, evolve.colors.red, "You were awarded 7 points at the start of the round" )
end
end )
hook.Add( "PlayerDeath", "PointsForKill", function( victim, weapon, killer)
if( ValidEntity( killer ) and ValidEntity( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
if( killer:IsTraitor() and not victim:IsTraitor() ) then
killer:PS_GivePoints( 10, victim:Nick().." was killed by "..killer:Nick() )
evolve:Notify( killer, evolve.colors.red, "You were awarded 10 points for killing an innocent" )
elseif( victim:IsTraitor() and not killer:IsTraitor() ) then
killer:PS_GivePoints( 10, victim:Nick().."[TRAITOR] was killed by "..killer:Nick().."[Inno.]" )
evolve:Notify( killer, evolve.colors.red, "You were awarded 10 points for killing a traitor" )
elseif( victim:IsTraitor() and killer:IsTraitor() ) then
killer:PS_TakePoints( 50, victim:Nick().."[TRAITOR] was team killed by "..killer:Nick().."[TRAITOR]" )
evolve:Notify( killer, evolve.colors.red, "You had 50 points taken from you for killing a fellow Traitor" )
else
evolve:Notify( killer, evolve.colors.red, "You killed an innocent!" )
end
end
end
end )
[/LUA]
Try that[/QUOTE]
Thanks man, works like a charm after adding a check to see if a traitor killed themself (that you gave me).
I have recently been having problems with everyone's points resetting and items being lost. I've been trying to fix it for a long time but i cannot find the problem which is leading to a hell storm of complaints and so on.
[CODE]
Hook 'PointShop_InitPostEntity' Failed: [@addons\pointshop\lua\sv_pointshop.lua:29] bad argument #1 to 'pairs' (table expected, got nil)
NULL Ent in GiveNamedItem! // I'm not sure if this has anything to do with pointshop but it looks like it might be and is a reoccurring error
Hook 'PointShop_loltrail_PlayerSpawn' Failed: [@lua\includes\extensions\table.lua:103] bad argument #1 to 'pairs' (table expected, got nil) // This shows up for MANY other items I'm just posting one to save space
[/CODE]
are you sure your using the latest rev?
i was the one that commited and tested it and so far it was working fine for me
Using the latest revision of the SVN I get this error every time a player connects:
[code]
[cl_pointshop.lua:178] attempt to index field '_Hats' (a nil value)
[/code]
There's also a whole bunch of this [code]
[LuaCmd:1] 'end' expected near '<eof>' [/code] but I'm not sure if this is from PointShop or not.
-modified-
[img]http://cfile209.uf.daum.net/original/135909594E228BEC3CBB71[/img]
How can i modify like this ? Show the wearing model Before buying item?
I saw many servers are modified like this.
[QUOTE=LuaChobo;31169004]A whole 20 minutes between posts[/QUOTE]
Sorry There was some lag on my computer
anyone?
Question, when I add a trail, and open the shop window, the preview of the trail shows the missing texture look (black and pink checker), but the trail itself works when you buy it. How do I fix this?
[QUOTE=woogers;31606015]Question, when I add a trail, and open the shop window, the preview of the trail shows the missing texture look (black and pink checker), but the trail itself works when you buy it. How do I fix this?[/QUOTE]
You typed the name of the trail wrong in the file.
But then it wouldn't work in-game. They use the same variable.
[QUOTE=Amokov;31617952]But then it wouldn't work in-game. They use the same variable.[/QUOTE]
Show us the trial code then. Just the trail you made, not all of them.
And remember to use lua tags please ;)
[QUOTE=Amokov;31617952]But then it wouldn't work in-game. They use the same variable.[/QUOTE]
There are two different variables, you most likely misspelled ITEM.Material.
[lua]ITEM.Material = "trails/lol"[/lua]
[lua]ply.Trail = util.SpriteTrail(ply, 0, team.GetColor(ply:Team()), false, 15, 1, 4, 0.125, item.Material .. ".vmt")[/lua]
It uses the same variable.
Back again, no, pretty sure it's not misspelled. The name of the trail is apple.vmt, and I have it in as trails/apple.
There is the shop for Deahtrun
or it works on Deahtrun
Hello there, I am interested in Taking this over.
I have added you on steam _Undefined me name is '[RIOT]Anonymous RapeStick'
This is long way dead and broken i suggest moving into Golden Forge instead
Not anymore, im now Working on it to fix it :)
Oh god 6 poster looking to take up a major addon.
You better be an alt.
New Thread [url]http://www.facepunch.com/threads/1126155?p=32357489#post32357489[/url]
[editline]18th September 2011[/editline]
[QUOTE=Amokov;32357377]Oh god 6 poster looking to take up a major addon.
You better be an alt.[/QUOTE]
Im an experienced Lua Coder who has never had a reason to sign up to the Facepunch forums as I am always working on projects.
[editline]18th September 2011[/editline]
[QUOTE=cyw960517;31204110]anyone?[/QUOTE]
Use a DModelPanel view.
I barely know you and i havent see any of your "Projects"
[lua]
[@lua\includes\extensions\table.lua:55] bad argument #1 to 'pairs' (table expected, got nil)
ERROR: Hook 'PointShop_PostPlayerDraw' Failed: [cl_pointshop.lua:479] attempt to index local 'attach' (a nil value)
Removing Hook 'PointShop_PostPlayerDraw'
[/lua]
Since i got this error , all of hats started to not appeared. What should i do?
[lua]
hook.Add("PostPlayerDraw", "PointShop_PostPlayerDraw", function(ply)
if not ply:Alive() then return end
if not POINTSHOP.Config.AlwaysDrawHats and not hook.Call("ShouldDrawHats", GAMEMODE) and ply == LocalPlayer() and GetViewEntity():GetClass() == "player" then return end
if ply._Hats and #ply._Hats then
for id, hat in pairs(ply._Hats) do
local pos = Vector()
local ang = Angle()
if not hat.Attachment and not hat.Bone then return end
if hat.Attachment then
local attach = ply:GetAttachment(ply:LookupAttachment(hat.Attachment))
pos = attach.Pos
ang = attach.Ang
elseif hat.Bone then
pos, ang = ply:GetBonePosition(ply:LookupBone(hat.Bone))
end
hat.Model, pos, ang = hat.Modify(hat.Model, pos, ang)
hat.Model:SetPos(pos)
hat.Model:SetAngles(ang)
hat.Model:SetRenderOrigin(pos)
hat.Model:SetRenderAngles(ang)
hat.Model:SetupBones()
hat.Model:DrawModel()
hat.Model:SetRenderOrigin()
hat.Model:SetRenderAngles()
end
end
end)
[/lua]
cl_pointshop.lua line of 446
[QUOTE=cyw960517;32470037][lua]
[@lua\includes\extensions\table.lua:55] bad argument #1 to 'pairs' (table expected, got nil)
ERROR: Hook 'PointShop_PostPlayerDraw' Failed: [cl_pointshop.lua:479] attempt to index local 'attach' (a nil value)
Removing Hook 'PointShop_PostPlayerDraw'
[/lua]
Since i got this error , all of hats started to not appeared. What should i do?
[lua]
hook.Add("PostPlayerDraw", "PointShop_PostPlayerDraw", function(ply)
if not ply:Alive() then return end
if not POINTSHOP.Config.AlwaysDrawHats and not hook.Call("ShouldDrawHats", GAMEMODE) and ply == LocalPlayer() and GetViewEntity():GetClass() == "player" then return end
if ply._Hats and #ply._Hats then
for id, hat in pairs(ply._Hats) do
local pos = Vector()
local ang = Angle()
if not hat.Attachment and not hat.Bone then return end
if hat.Attachment then
local attach = ply:GetAttachment(ply:LookupAttachment(hat.Attachment))
pos = attach.Pos
ang = attach.Ang
elseif hat.Bone then
pos, ang = ply:GetBonePosition(ply:LookupBone(hat.Bone))
end
hat.Model, pos, ang = hat.Modify(hat.Model, pos, ang)
hat.Model:SetPos(pos)
hat.Model:SetAngles(ang)
hat.Model:SetRenderOrigin(pos)
hat.Model:SetRenderAngles(ang)
hat.Model:SetupBones()
hat.Model:DrawModel()
hat.Model:SetRenderOrigin()
hat.Model:SetRenderAngles()
end
end
end)
[/lua]
cl_pointshop.lua line of 446[/QUOTE]
Your player model doesn't have the attachment the hat is trying to use. Use a different player model.
Sorry, you need to Log In to post a reply to this thread.