Trying to mod in the ability to give players MORE points if they are wearing certain items.
I am aiming to just use the PS_HasItem( id) to add more points if they have it and have it equipped (I can do another check or something later)
But the problem is HasItem takes an item ID which I have no idea what these items would actually be....
Is there anyway to check what the id of an item is? (without getting a hexeditor and checking the server.db?)
id is the filename
conehat.lua
[code]local has_item = ply:PS_HasItemEquipped('conehat')[/code]
[t]http://5crat.ch/a/qz2o[/t]
Ah cool, I thought it was at first then saw that it said id for the function sig and was like duuuuur...
Well then thanks and excuse the stupidity :P
[editline]11th February 2015[/editline]
Well this code crashes the whole TTT works anytime I put it in...can you see any thing that I messed up by chance?
[CODE]
if PS.Config.PointsOverTime then
timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
if !IsValid(self) then return end
--added code
local pointsTotal = PS.Config.PointsOverTimeAmount
if(ply:PS_HasItemEquipped('treasurechest')) then --Or is it because I put brackets on my if ...still derpin in lua and used to c#/C++...
pointsTotal += 15
end
--End of added
self:PS_GivePoints(pointsTotal) -- changed to the new value
self:PS_Notify("You've been given ", pointsTotal, " ", PS.Config.PointsName, " for playing on the server!") --changed to new value
end) --could it be this extra bracket?
end
[/CODE]
Original code in that section is
[CODE]
if PS.Config.PointsOverTime then
timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
if !IsValid(self) then return end
self:PS_GivePoints(PS.Config.PointsOverTimeAmount)
self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount, " ", PS.Config.PointsName, " for playing on the server!")
end)
end
[/CODE]
+= is not a lua operator. var = var + amt is the syntax
I'll give it a try when I get home.
Nope, still changing the code in that file to that with pointsTotal = pointsTotal + 15 makes my server bug right the fuck out...
[QUOTE=TooLzor;47134003]Nope, still changing the code in that file to that with pointsTotal = pointsTotal + 15 makes my server bug right the fuck out...[/QUOTE]
Post console logs?
[code]76561197994048935
ConVarRef ttt_time_limit_minutes doesn't point to an existing ConVar
ConVarRef ttt_round_limit doesn't point to an existing ConVar
ConVarRef spraymon_nooverspraying doesn't point to an existing ConVar
ConVarRef gmod_physiterations doesn't point to an existing ConVar
Oops! This addon () isn't for Garry's Mod - it's for 0!
Oops! This addon () isn't for Garry's Mod - it's for 0!
PREP OK
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template003d
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template003h
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template003o
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template002b
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template002c
env_cubemap used on world geometry without rebuilding map. . ignoring: concrete/milflr001
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template003b
env_cubemap used on world geometry without rebuilding map. . ignoring: concrete/concretefloor011a_c17
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template006b
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template006a
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template001f
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template001b
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template002i
env_cubemap used on world geometry without rebuilding map. . ignoring: de_chateau/interiortile02
env_cubemap used on world geometry without rebuilding map. . ignoring: effects/offelevdrsa
env_cubemap used on world geometry without rebuilding map. . ignoring: tile/tileroof004a_c17
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template019c
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template013c
env_cubemap used on world geometry without rebuilding map. . ignoring: metal/milmirror001
env_cubemap used on world geometry without rebuilding map. . ignoring: metal/citadel_tilefloor016a
env_cubemap used on world geometry without rebuilding map. . ignoring: concrete/concretefloor005a
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template004b
env_cubemap used on world geometry without rebuilding map. . ignoring: metal/metalroof004a
env_cubemap used on world geometry without rebuilding map. . ignoring: metal/metalroof005a
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template013b
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen08
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template007b
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template013h
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template010g
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen24
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen19
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen15
env_cubemap used on world geometry without rebuilding map. . ignoring: concrete/concretefloor033k
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen20
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen23
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen09
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen07
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template011c
env_cubemap used on world geometry without rebuilding map. . ignoring: tile/tileroof004b
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen17
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen21
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen01
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen16
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_template021i
env_cubemap used on world geometry without rebuilding map. . ignoring: concrete/concretefloor033k_c17
env_cubemap used on world geometry without rebuilding map. . ignoring: props/plasticceiling003a
env_cubemap used on world geometry without rebuilding map. . ignoring: building_template/building_trainstation_template002e
env_cubemap used on world geometry without rebuilding map. . ignoring: de_nuke/nukwindowa
env_cubemap used on world geometry without rebuilding map. . ignoring: buildings/gen18
env_cubemap used on world geometry without rebuilding map. . ignoring: de_cbble/trim06
env_cubemap used on world geometry without rebuilding map. . ignoring: brick/brickwall031b
material treasurechest/chesttex has a normal map and an envmapmask. Must use $normalmapalphaenvmapmask.
SOLID_VPHYSICS static prop with no vphysics model! (models/props_foliage/tree_deciduous_card_01_skybox.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props_foliage/tree_deciduous_card_01_skybox.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props_foliage/tree_deciduous_card_01_skybox.mdl)
SOLID_VPHYSICS static prop with no vphysics model! (models/props_foliage/tree_deciduous_card_01_skybox.mdl)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrrt)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrbk)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrlf)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrft)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrup)
Requesting texture value from var "$basetexture" which is not a texture value (material: skybox/militia_hdrdn)
Detail prop model models/props/de_inferno/fountain_plants.mdl is using vertex-lit materials!
It must use unlit materials!
clientside lua startup!
You are running ULib version 2.51.
[ULIB] Loading SHARED module: ulx_init.lua
[ULX] Loading CLIENT module: motdmenu.lua
[ULX] Loading CLIENT module: uteam.lua
[ULX] Loading CLIENT module: xgui_client.lua
[ULX] Loading CLIENT module: xgui_helpers.lua
[ULX] Loading CLIENT module: xlib.lua
[ULX] Loading SHARED module: cc_chat.lua
[ULX] Loading SHARED module: cc_cvars.lua
[ULX] Loading SHARED module: cc_effects.lua
[ULX] Loading SHARED module: cc_fun.lua
[ULX] Loading SHARED module: cc_menus.lua
[ULX] Loading SHARED module: cc_pgag.lua
[ULX] Loading SHARED module: cc_rcon.lua
[ULX] Loading SHARED module: cc_teleport.lua
[ULX] Loading SHARED module: cc_util.lua
[ULX] Loading SHARED module: cc_voting.lua
[ULX] Loading SHARED module: chat.lua
[ULX] Loading SHARED module: donate.lua
[ULX] Loading SHARED module: essentials.lua
[ULX] Loading SHARED module: fun.lua
[ULX] Loading SHARED module: menus.lua
[ULX] Loading SHARED module: rcon.lua
[ULX] Loading SHARED module: teleport.lua
[ULX] Loading SHARED module: ttt_admin.lua
[ULX] Loading SHARED module: ttt_fun.lua
[ULX] Loading SHARED module: ttt_utility.lua
[ULX] Loading SHARED module: user.lua
[ULX] Loading SHARED module: userhelp.lua
[ULX] Loading SHARED module: util.lua
[ULX] Loading SHARED mod
Alright, there should be a minidump on the root of the server
You also have an error in one of your entities: [ERROR] gamemodes/terrortown/entities/entities/deadringer_shared.lua:33: attempt to index global 'SWEP' (a nil value)
1. unknown - gamemodes/terrortown/entities/entities/deadringer_shared.lua:33
SWEP is used in entities/weapons/ where ENT is used in entities/entities/
I'd also recommend adding all content in an addon file ( if you have lua/entities/ or lua/weapons/ folder in your addon and it uses the same filename as a pre-existing weapon, it'll overwrite it so it'll be safe from being overwritten during updates in addon form )
yeah I removed that because it's apparently full busted anyways
But I couldn't get the server to un fuck itself so I had to over write (luckily I had a back up of the items) the pointshop
That's why it's always best to leave the code alone and create an addon. The nice thing is addons mimic the gmod directory structure... Gamemodes spread it out a bit..
So: Addons/name/lua/entities/ is the same as gamemodes/terrortown/entities/entities/
lua/weapons/ is same as ... entities/weapons/
So, you can create lua files in there to overwrite terrortown sweps without editing core data. This ensures if there's a problem, the game-mode wasn't messed with so you only need to change the addon code.
Yeah for this edit it was just in an addon already.
Sorry, you need to Log In to post a reply to this thread.