• Buyin Traitor won't show up in the pointshop
    4 replies, posted
[lua]ITEM.Name = '<span class="highlight">Traitor</span>' ITEM.Price = 2000 ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt' ITEM.OneUse = true ITEM.AllowedUserGroups = { "donator", "customrank", "admin", "superadmin" } if SERVER then local plymeta = FindMetaTable( "Player" ) if not plymeta then return end plymeta.inTraitorCooldown = false end function ITEM:CanPlayerBuy(ply) return ply.inTraitorCooldown end function ITEM:OnEquip(ply, modifications) hook.Add("TTTBeginRound", ply:UniqueID() .. "_traitor", function() if ply:GetRoleString() != "<span class="highlight">traitor</span>" then ply:SetRole(ROLE_TRAITOR) ply:AddCredits(GetConVarNumber("ttt_credits_starting")) end if SERVER then ply.inTraitorCooldown = true timer.Simple(1200, function() ply.inTraitorCooldown = false end) 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 function ITEM:OnSell(ply) hook.Remove("TTTBeginRound", ply:UniqueID() .. "_traitor") end[/lua] Why won't it show up :(
[QUOTE=Noon;41813989][lua] if ply:GetRoleString() != "<span class="highlight">traitor</span>" then [/lua] Why won't it show up :([/QUOTE] [lua] if ply:GetRoleString() != "<span class=\"highlight\">traitor</span>" then [/lua] If you want to insert a double quote character in a string that is being defined with double quotes, you have to add a backslash character in front of it, it's called an escape sequence. [URL="http://en.wikibooks.org/wiki/Lua_Programming/How_to_Lua/escape_sequenc"]http://en.wikibooks.org/wiki/Lua_Programming/How_to_Lua/escape_sequenc[/URL]
[QUOTE=circuitbawx;41814029][lua] if ply:GetRoleString() != "<span class=\"highlight\">traitor</span>" then [/lua] If you want to insert a double quote character in a string that is being defined with double quotes, you have to add a backslash character in front of it, it's called an escape sequence. [URL="http://en.wikibooks.org/wiki/Lua_Programming/How_to_Lua/escape_sequenc"]http://en.wikibooks.org/wiki/Lua_Programming/How_to_Lua/escape_sequenc[/URL][/QUOTE] Okay that got the icon to come up, now it won't work when I buy it.
[CODE]ITEM.Name = '<span class="highlight">Traitor</span>'[/CODE] Is there a reason this is your item name? I have no idea how pointshop works but this could have something to do with it.
[QUOTE=circuitbawx;41814191][CODE]ITEM.Name = '<span class="highlight">Traitor</span>'[/CODE] Is there a reason this is your item name? I have no idea how pointshop works but this could have something to do with it.[/QUOTE] Because it wouldn't show the icon any way else.... It won't work when I buy it now. Someone help?
Sorry, you need to Log In to post a reply to this thread.