Annas Posted December 25, 2015 Share Posted December 25, 2015 Hi , i have made this simple server side code function onlineStaff(thePlayer) local admins = {} for _,player in ipairs(getElementsByType("player")) do if(exports.CSTadmin:isPlayerStaff(player)) then table.insert(admins,getPlayerName(player)) end end if(#admins > 0) then exports.CSTtexts:output("Online staff: "..table.concat(admins,", "),thePlayer, 0,255,0) else exports.CSTtexts:output("No Staff is currently online!",thePlayer,255,0,0) end end addCommandHandler("onlinestaffs", onlineStaff) I must do ./onlinestaffs , to view currently online staffs .. , how can i make it "/online staffs" ? Please help. Link to comment
Noki Posted December 25, 2015 Share Posted December 25, 2015 function onlineStaff(thePlayer, _, cmd) local admins = {} if (cmd == "staffs") then for _,player in ipairs(getElementsByType("player")) do if(exports.CSTadmin:isPlayerStaff(player)) then table.insert(admins,getPlayerName(player)) end end if(#admins > 0) then exports.CSTtexts:output("Online staff: "..table.concat(admins,", "),thePlayer, 0,255,0) else exports.CSTtexts:output("No Staff is currently online!",thePlayer,255,0,0) end end end addCommandHandler("online", onlineStaff) Link to comment
Recommended Posts