• Buy in traitor won't purchase in pointshop???
    8 replies, posted
when i go to purchase it, it doesn't take any points away, and it doesn't work at all... here's my code [lua]TRAITOR = ttt_force_traitor ITEM.Name = 'Traitor' ITEM.Price = 5000 ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt' ITEM.OneUse = true function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if not ply:GetRoleString() != "traitor" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end if SERVER then ply:PS_TakeItem(self.ID) end hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor") end) end function ITEM:OnHolster(ply) hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor") end[/lua] Could someone help me figure out why? [highlight](User was permabanned for this post ("spamming" - postal))[/highlight]
Well, after briefly looking through through all three threads you've made, I'm largely looking at this line, which someone else mentioned. [CODE]TRAITOR = ttt_force_traitor[/CODE] Like, what does this even mean? Have you tried removing it? Edit: Oh, ignore me then. I see in one of the threads you did indeed remove. Do try and stick to one thread, though. Multiple ones just look confusing
[QUOTE=NiandraLades;41815635]Well, after briefly looking through through all three threads you've made, I'm largely looking at this line, which someone else mentioned. [CODE]TRAITOR = ttt_force_traitor[/CODE] Like, what does this even mean? Have you tried removing it? Edit: Oh, ignore me then. I see in one of the threads you did indeed remove. Do try and stick to one thread, though. Multiple ones just look confusing[/QUOTE] I removed it, still does not remove any of my points and does not work.
Acecool just pointed out [CODE]if not ply:GetRoleString() != "traitor" then[/CODE] not !=
[QUOTE=circuitbawx;41815710]Acecool just pointed out [CODE]if not ply:GetRoleString() not != "traitor" then[/CODE] not !=[/QUOTE] [QUOTE=circuitbawx;41815710]Acecool just pointed out [CODE]if not ply:GetRoleString() not != "traitor" then[/CODE] That removed it from the pointshop. [editline]12th August 2013[/editline] Can someone help me with this?!?!!?
Replace: [lua]function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if not ply:GetRoleString() != "traitor" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end[/lua] with [lua]function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if ply:GetRoleString() != "traitor" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end[/lua] Lua got 2 type of "not" compares. -Normal: if stuff [b][u]==[/u][/b] stuff then (if stuff is the same) -Not in symbol: if stuff [b][u]!=[/u][/b] stuff then (if the stuff is different) -Not in text: if [b][u]not[/u][/b] stuff [u][b]==[/b][/u] stuff then (if the stuff is different) Not sure how lua handles a double negative .. but the other code should only work for players who are the traitor. “There will [b]never[/b] be [b]no[/b] love at all.” = “There will be love at all.” -Bob Marley
[QUOTE=Nak;41816243]Replace: [lua]function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if not ply:GetRoleString() != "traitor" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end[/lua] with [lua]function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if ply:GetRoleString() != "traitor" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end[/lua] Lua got 2 type of "not" compares. -Normal: if stuff [b][u]==[/u][/b] stuff then (if stuff is the same) -Not in symbol: if stuff [b][u]!=[/u][/b] stuff then (if the stuff is different) -Not in text: if [b][u]not[/u][/b] stuff [u][b]==[/b][/u] stuff then (if the stuff is different) Not sure how lua handles a double negative .. but the other code should only work for players who are the traitor. “There will [b]never[/b] be [b]no[/b] love at all.” = “There will be love at all.” -Bob Marley[/QUOTE] Replaced it, and it still doesn't buy, i click buy then the box pops up and i click ok and it doesn't take away any points, or anything. [editline]13th August 2013[/editline] Anyone :((
Can you stop making these stupid threads? It seems you know NOTHING about lua.
[QUOTE=kila58;41816464]Can you stop making these stupid threads? It seems you know NOTHING about lua.[/QUOTE] I just need to know how to fix this.. there's no need to be mean there buddy.. [editline]13th August 2013[/editline] Someone help please :(
Sorry, you need to Log In to post a reply to this thread.