Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2024, 05:31:45 AM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: This may seem stupid, buuuuuuuuuuuuuuuuuuut...
Pages: [1]
Author Topic: This may seem stupid, buuuuuuuuuuuuuuuuuuut...  (Read 2956 times)
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« on: January 02, 2011, 07:25:27 AM »

What is the code used to determine if someone is the traitor? As in, what makes if ply:IsTraitor work? Where is the code making IsTraitor an actual working part of a function?

(Just point me in the direction of the file it's in/paste it in a post and I'll be happy :) )
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: January 02, 2011, 09:24:39 AM »

player_ext_shd.lua

AccessorFunc(plymeta, "role", "Role", FORCE_NUMBER)

-- Role access
function plymeta:GetTraitor() return self:GetRole() == ROLE_TRAITOR end
function plymeta:GetDetective() return self:GetRole() == ROLE_DETECTIVE end

plymeta.IsTraitor = plymeta.GetTraitor
plymeta.IsDetective = plymeta.GetDetective

That "AccessorFunc" generates SetRole and GetRole functions. The underlying field is ply.role, which is just a number.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: This may seem stupid, buuuuuuuuuuuuuuuuuuut... « 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.