General > Developers Corner

Question about modules

(1/1)

Pac:
Hey, I got this code:


--- Code: ---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." )
--- End code ---

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: ---// 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! //
--- End code ---
part

All help is appreciated, thank you. :)

Megiddo:
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.

JamminR:
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)

Pac:
Yeah it's a Linux server and yes it has been copied properly to the server

Navigation

[0] Message Index

Go to full version