• Print

Author Topic: Jailbreak AFK command has no effect.  (Read 4449 times)

0 Members and 1 Guest are viewing this topic.

Offline jakej78b

  • Newbie
  • *
  • Posts: 26
  • Karma: 4
Jailbreak AFK command has no effect.
« on: June 10, 2014, 11:37:23 pm »
I can't.. for the goodness of me figure out why this command does nothing. Also, what is the default ULib access for user? I just used "user" but I saw that things like admin had defaultAccess( ULib.ACCESS_ADMIN )

Code: Lua
  1.  
  2. function ulx.afk( target_ply)
  3.         if target_ply.NextAFK > CurTime() and target_ply.NextAFK ~= nil then
  4.                 ULib.tsayError( target_ply, "You can only use AFK once a minute!", true )
  5.         else
  6.                 if not target_ply.AFK then
  7.                         target_ply:StripWeapons()
  8.                         target_ply:KillSilent()
  9.                         timer.Simple( 0.1, function()
  10.                                 target_ply:SetTeam(TEAM_SPECTATOR)
  11.                                 target_ply:Spectate(OBS_MODE_ROAMING)
  12.                                 ulx.fancyLogAdmin( calling_ply, "#A went AFK.", target_ply )
  13.                         end)
  14.                 else
  15.                         target_ply:SetTeam(TEAM_PRISONER_DEAD)
  16.                         ulx.fancyLogAdmin( calling_ply, "#A came back from being AFK.", target_ply )
  17.                 end    
  18.                 target_ply.NextAFK = CurTime() + 60
  19.                 target_ply.AFK = not target_ply.AFK
  20.         end
  21. end
  22. local afk = ulx.command( "Jailbreak", "ulx afk", ulx.afk, "!afk" )
  23. afk:defaultAccess( "user" )
  24. afk:help( "Become (un)AFK." )
  25.  

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Jailbreak AFK command has no effect.
« Reply #1 on: June 11, 2014, 05:17:32 am »
"defaultAccess" isn't a string. For user it would be "ULib.ACCESS_ALL" without the quotes. That's probably why it doesn't do anything.

For future reference, these are the access levels:
  • ULib.ACCESS_ALL
  • ULib.ACCESS_ADMIN
  • ULib.ACCESS_SUPERADMIN
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

  • Print