Hello there,
I have a problem right now with my scoreboard, and my setteam thing.
I can press on players name and choose Set Team. But if I have this code: settheteam:AddOption("Test ...", function() pl:SetTeam(TEAM_CITIZEN) end)
I get errors with that code.
But when I try this code: settheteam:AddOption("Citizen", function() pl:ConCommand("say /citizen") end)
I only set my own job, and can't set others.
What have I done wrong here ?
Best regards,
Martin
[code]settheteam:AddOption("Citizen", function() RunConsoleCommand("setteam", Player:EntIndex(), "citizen") end)
-- Remember to replace "Player" with whatever variable you are using. pl, I guess?[/code]
And [b]serverside[/b]:
[code]
concommand.Add("setteam",function(ply, cmd, args)
if ( !ply:IsAdmin() || !args[1] || !args[2] ) then return end
local pl = Entity(args[1])
if ( !IsValid( pl ) || !pl:IsPlayer() ) then return end
local team = TEAM_MYDEFAULTTEAM
if ( args[2] == "citizen" ) then team = TEAM_CITIZEN end
pl:SetTeam( team )
end)[/code]
Untested.
What's wrong is that you are trying to do a serverside action clientside.
Hmm.. Dosen't work..
Admins and Super admins should be able to change players team via the scoreboards menu.
If I use the first command you sent I get this:
Couldn't include file 'darkrp\gamemode\shared\fadmin_darkrp.lua' (File not found) (@gamemodes/darkrp/gamemode/cl_init.lua (line 500))
[ERROR] gamemodes/darkrp/gamemode/cl_scoreboard.lua:377: attempt to call method 'SetTeam' (a nil value)
1. unknown - gamemodes/darkrp/gamemode/cl_scoreboard.lua:377
2. unknown - lua/includes/modules/concommand.lua:69
If I use the second you sent, the job Citizen will not show up in the scoreboard "Set Team" section.
Hello again,
Can someone help me with this problem.
I have this code:
settheteam:AddOption("Citizen", function() RunConsoleCommand("rp_citizen", "rp_citizen") end)
When I choose a player in my scoreboard, and set the players team.
Then I get this in console.
"Could not find player: rp_citizen"
Sorry, you need to Log In to post a reply to this thread.