Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 02:09:21 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: lua - determine if player is traitor
Pages: [1]
Author Topic: lua - determine if player is traitor  (Read 7695 times)
centran
Poster

Posts: 3


« on: February 11, 2012, 10:58:41 PM »

How would you write an if/else statement to determine if a player is a traitor or not?
is there a function like ply:getRole()
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #1 on: February 11, 2012, 11:29:41 PM »

-snip-
« Last Edit: February 13, 2012, 11:27:33 PM by Mr. Gash »
Anonymous
Poster

Posts: 126


« Reply #2 on: February 12, 2012, 02:15:04 PM »



if player.IsTraitor() then
    PrintMessageAll( HUD_PRINTTALK, ply:Nick().. "IS A TRAITOR!"


Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #3 on: February 12, 2012, 03:50:03 PM »

Not sure if Anonymous is trolling or he does not know shit about lua.
PrintMessageAll does not exist

On TTT, you have player.IsActiveTraitor()

Example:

for k,v in pairs(player.GetAll()) do
   if v:IsActiveTraitor() then
       -- Ye loopception
       for _s, in pairs(player.GetAll()) do
          s:ChatPrint(v:Nick().." IS A TRAITOR!")
      end
   end
end
Anonymous
Poster

Posts: 126


« Reply #4 on: February 13, 2012, 10:38:53 AM »

Trolling ;)

centran
Poster

Posts: 3


« Reply #5 on: February 13, 2012, 10:21:29 PM »

Not sure if Anonymous is trolling or he does not know shit about lua.
PrintMessageAll does not exist

On TTT, you have player.IsActiveTraitor()

Example:

for k,v in pairs(player.GetAll()) do
  if v:IsActiveTraitor() then
      -- Ye loopception
      for _s, in pairs(player.GetAll()) do
          s:ChatPrint(v:Nick().." IS A TRAITOR!")
      end
  end
end



v:IsActiveTraitor()

thank you. that is what I was looking for.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: lua - determine if player is traitor « 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 18 queries.