Author Topic: setTeam Not a Function? [SLAYER]  (Read 677 times)

server.cs
Code: [Select]
//Slayer stuff
if(!$Slayer::Server::Dependencies::Gamemodes)
exec("Add-Ons/Gamemode_Slayer/Dependencies/Gamemodes.cs");

Slayer.Gamemodes.addMode("Infection","Infection",1,1);

function onSpawn(%mini,%client)
{
%client.setTeam("Healthy");
}

function postDeath(%mini, %client,%obj,%killer,%type,%area)
{
%client.setTeam("Infected");
}

function serverCmdinfectme(%cl)
{
%cl.setTeam("Infected");
}

console.log
Code: [Select]

Add-Ons/Gamemode_Infection/server.cs (0): Unknown command setTeam.
  Object LocalClientConnection(10960) GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> GameConnection -> NetConnection -> SimGroup -> SimSet -> SimObject -> SimObject
==>quit();

ninja edit: I put servercmdinfectme in there purposely for testing.

You need to do %team.addMember(%client); It's just like minigames.

But anyway I already have the Infection game mode finished pretty much.

Try the joinTeam gameconnection method which uses the addMember method on the team object :
Code: [Select]
function GameConnection::joinTeam(%this,%flag) //for events
{
%mini = getMinigameFromObject(%this);
if(!isSlayerMinigame(%mini))
return;

%team = %mini.Teams.getTeamFromName(%flag);
if(isObject(%team))
%team.addMember(%this);
}