Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2024, 02:42:44 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Lua Help - "Killed with..."
Pages: [1]
Author Topic: Lua Help - "Killed with..."  (Read 4236 times)
nrich588
Poster

Posts: 253

WzG Owner


« on: August 19, 2011, 10:39:50 PM »

I am trying to change some gamemode lua so that when you read a body, instead of seeing
"Was killed by an M16" it would say "Killed with 9mm Ammo". I have found the variable(s) that I would need to meddle with.

-- init a heap of data we'll be sending
  local nick  = CORPSE.GetPlayerNick(rag)
  local traitor = (rag.was_role == ROLE_TRAITOR)
  local role  = rag.was_role
  local eq    = rag.equipment or EQUIP_NONE
  local c4    = rag.bomb_wire or -1
  local dmg  = rag.dmgtype or DMG_GENERIC
  local wep  = rag.dmgwep or ""
  local words = rag.last_words or ""
  local hshot = rag.was_headshot or false
  local dtime = rag.time or 0
found in /terrortown/gamemode/corpse.lua

BKU recommended I change it with a else/if statement instead of changing/creating a new variable to hold info. Anyone that could help me out with this problem I would greatly appreciate.
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: August 20, 2011, 07:29:56 AM »

I recommended using if/else to convert the weapon to an ammo type on the client in cl_search.lua, because it's easier than the proper method. The proper method would be to send a gun's ammo name instead of the weapon name in corpse.lua and then display it properly in cl_search.lua, which requires more work and skill.
nrich588
Poster

Posts: 253

WzG Owner


« Reply #2 on: August 20, 2011, 07:21:51 PM »

Would this be it?

if wname="Shotgun"
local wname = wep and LANG.TryTranslation(ammo.PrintName)
end
Charles445
Build Tester
*
Posts: 2338


I LOVE THIS AVATAR


« Reply #3 on: August 20, 2011, 09:59:44 PM »

I think you forgot a 'then' in there.

del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.

Bookcases, Bookcases Everywhere
nrich588
Poster

Posts: 253

WzG Owner


« Reply #4 on: August 20, 2011, 10:01:42 PM »

Sorry, I'm used to JavaScript where it would be
if (wname="Shotgun") {
vashahdfhadfji;
}
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Lua Help - "Killed with..." « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.008 seconds with 17 queries.