Author Topic: Question about modules  (Read 1967 times)

0 Members and 1 Guest are viewing this topic.

Offline Pac

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Question about modules
« on: November 28, 2012, 01:01:34 PM »
Hey, I got this code:

Code: [Select]
local CATEGORY_NAME = "TTT"

function ulx.ttt_respawn( calling_ply, target_plys )
local affected_plys = {}

for i = 1, #target_plys do
local v = target_plys[i]
v:SpawnForRound( true )
table.insert( affected_plys, v )
end

ulx.fancyLogAdmin( calling_ply, "#A respawned #T", affected_plys )
end

local respawn = ulx.command( CATEGORY_NAME, "ulx respawn", ulx.ttt_respawn, "!respawn" )
respawn:addParam{ type=ULib.cmds.PlayersArg }
respawn:defaultAccess( ULib.ACCESS_ADMIN )
respawn:help( "Respawns target(s)." )

function ulx.ttt_traitor( calling_ply, target_plys )
local affected_plys = {}

for k, v in pairs( target_plys ) do
local v = target_plys[k]
v:SetRole( ROLE_TRAITOR )
SendFullStateUpdate()
table.insert( affected_plys, v )
end

ulx.fancyLogAdmin( calling_ply, "#A turned #T into a traitor.", affected_plys )
end

local traitor = ulx.command( "Fun", "ulx traitor", ulx.ttt_traitor, "!traitor", true )
traitor:addParam{ type=ULib.cmds.PlayersArg }
traitor:defaultAccess( ULib.ACCESS_ADMIN )
traitor:help( "Turns target(s) into a traitor." )

function ulx.ttt_detective( calling_ply, target_plys )
local affected_plys = {}

for k, v in pairs( target_plys ) do
local v = target_plys[k]
v:SetRole( ROLE_DETECTIVE )
SendFullStateUpdate()
table.insert( affected_plys, v )
end

ulx.fancyLogAdmin( calling_ply, "#A turned #T into a detective.", affected_plys )
end

local detective = ulx.command( "Fun", "ulx detective", ulx.ttt_detective, "!detective", true )
detective:addParam{ type=ULib.cmds.PlayersArg }
detective:defaultAccess( ULib.ACCESS_ADMIN )
detective:help( "Turns target(s) into a detective." )

function ulx.ttt_innocent( calling_ply, target_plys )
local affected_plys = {}

for k, v in pairs( target_plys ) do
local v = target_plys[k]
v:SetRole( ROLE_INNOCENT )
SendFullStateUpdate()
table.insert( affected_plys, v )
end

ulx.fancyLogAdmin( calling_ply, "#A turned #T into an innocent.", affected_plys )
end

local innocent = ulx.command( "Fun", "ulx innocent", ulx.ttt_innocent, "!innocent", true )
innocent:addParam{ type=ULib.cmds.PlayersArg }
innocent:defaultAccess( ULib.ACCESS_ADMIN )
innocent:help( "Turns target(s) into an innocent." )

And it absolutely refuses to load on my server, it's located in "addons/ULX/lua/ulx/modules/sh/testy.lua" and no matter what I've done so far, it's failed and doesn't work nor show up in the console in the
Code: [Select]
// MODULE: chat.lua //
// MODULE: fun.lua //
// MODULE: menus.lua //
// MODULE: rcon.lua //
// MODULE: teleport.lua //
// MODULE: user.lua //
// MODULE: userhelp.lua //
// MODULE: util.lua //
// MODULE: vote.lua //
// end.lua //
// Load Complete! //
part

All help is appreciated, thank you. :)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Question about modules
« Reply #1 on: November 28, 2012, 02:47:52 PM »
Is this a Linux server? Are the permissions set correctly on the file?

Otherwise, nothing immediately comes to mind. All files from the "sh" directory are loaded dynamically, so if one file didn't load, none of them ought to load.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Question about modules
« Reply #2 on: November 28, 2012, 03:58:20 PM »
Though you stated you copied it to your server's folder, make sure you did... I don't know how many times I've copied code I've worked on to my client folder, to of course, have it do nothing.
(Easy to do when running server/client from same machine for testing)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Pac

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Question about modules
« Reply #3 on: December 01, 2012, 12:45:33 PM »
Yeah it's a Linux server and yes it has been copied properly to the server