General > Developers Corner
Ulx respawn command - ttt
Nordic Husky:
Hello, I'm having some issues coding a respawn command for a ttt server,
I can not find out what's wrong.....
Even if I change the "v:Kill()" in the slay command to "v:Spawn()" and change "elseif not" to "elseif"
it still comes up with lua errors, Can someone give me / help me make a working respawn command? C:
Megiddo:
What are the errors?
nathan736:
might want to hunt down the lua for spawning in the ttt game mode see any args you need to have for tables in the gamemode
im not at home atm so cant do it for you :-X
Nordic Husky:
I managed to make the script working now, Tho' I now want to know if it's possible to disguise an admin? by changing the name showing and the picture and printing that your normal name disconnected and that the new name connected?. If so, how?
--- Code: ---local CATEGORY_NAME = "ttt"
------------------------------ Spawn ------------------------------
function ulx.tspawn( calling_ply, target_plys )
local affected_plys = {}
for i=1, #target_plys do
local v = target_plys[ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is already alive!", true )
elseif v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
else
v:SetTeam("Terrorists")
v:Spawn()
table.insert( affected_plys, v )
end
ulx.fancyLogAdmin( calling_ply, "#A spawned #T", affected_plys )
end
local tspawn = ulx.command( CATEGORY_NAME, "ulx tspawn", ulx.spawn, "!tspawn" )
tspawn:addParam{ type=ULib.cmds.PlayersArg }
tspawn:defaultAccess( ULib.ACCESS_ADMIN )
tspawn:help( "Spawn target(s) as terrorist." )
function ulx.traitor( Calling_ply, target_plys )
local affected_plys= {}
for i=1 #target_plys do
local v = target_plys [ i ]
if ulx.getExclusive( v, calling_ply ) then
Ulib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true)
elseif v:IsFrozen() then
Ulib.tsayError( calling_ply, v:Nick() .. " is frozen!", true)
else
v:SetRole(ROLE_TRAITOR)
sendFullStateUpdate()
end
end
end
local traitor = ulx.command( CATEGORY_NAME, "ulx traitor", ulx.traitor, "!traitor" )
traitor:addParam{ type=ULib.cmds.PlayersArg }
traitor:defautlAccess( ULib.ACCESS_ADMIN )
traitor:help( "Force target(s) to traitor" )
function ulx.detective( Calling_ply, target_plys )
local affected_plys= {}
for i=1 #target_plys do
local v = target_plys [ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true)
elseif v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true)
else
v:SetRole(ROLE_DETECTIVE)
sendFullStateUpdate()
end
end
end
local detective = ulx.command( CATEGORY_NAME, "ulx detective", ulx.detective, "!detective" )
detective:addParam{ type=Ulib.cmds.PlayersArg }
detective:defaultAccess( ULib.ACCESS_ADMIN )
detective:help( "Force target(s) to detective" )
function ulx.innocent( Calling_ply, target_plys )
local affected_plys= {}
for i=1 #target_plys do
local v = target_plys [ i ]
if ulx.getExclusive( v, calling_ply ) then
ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
elseif not v:Alive() then
ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true )
elseif v:IsFrozen() then
ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
else
v:SetRole(ROLE_INNOCENT)
sendFullStateUpdate()
end
end
end
local innocent = ulx.command( CATEGORY_NAME, "ulx innocent", ulx.innocent, "!innocent" )
innocent:addParam{ type.ULib.cmds.PlayersArg }
innocent:defaultAccess( ULib.ACCESS_ADMIN )
innocent:help( "Froce target(s) to innocent" )
--- End code ---
Nordic Husky:
I just tested the code, It apparently did not work, I got a different working code at home :P
Navigation
[0] Message Index
[#] Next page
Go to full version