09-10-2012, 00:43
09-10-2012, 05:01
(09-10-2012, 00:43)Nerus Wrote: [ -> ]Hi, can Devs add OnChangeTeam ?
example:
CSHARP Code
- if (Message.StartsWith("!allies"))
- {
- Client.Team = Teams.Allies;
- return ChatType.ChatNone;
- }
- if (Message.StartsWith("!axis"))
- {
- Client.Team = Teams.Axis;
- return ChatType.ChatNone;
- }
- if (Message.StartsWith("!spect"))
- {
- Client.Team = Teams.Spectator;
- return ChatType.ChatNone;
- }
09-10-2012, 05:35
@litgar i think he acctually mean the EVENT not on how to change team.
Please read the question before posting...
And im sure @zxz0O0 will take a look at this.
Thanks Barata...
Please read the question before posting...
And im sure @zxz0O0 will take a look at this.
Thanks Barata...
09-10-2012, 06:04
the difficulties of translation....
09-10-2012, 08:37
You can manually check every ServerFrame if somebody changed team.
09-10-2012, 10:00
Which isn't very resource efficient.
09-10-2012, 11:26
CSHARP Code
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Addon;
-
- namespace teamchange
- {
- public class Class1:CPlugin
- {
- public void OnTeamChange(ServerClient Client)
- {
- }
- public override void OnPlayerDisconnect(ServerClient Client)
- {
- Team.Remove(Client.ClientNum);
- }
- public override void OnPlayerSpawned(ServerClient Client)
- {
- if (!Team.ContainsKey(Client.ClientNum))
- {
- Team.Add(Client.ClientNum, Client.Team);
- }
- else
- {
- if (Team[Client.ClientNum] != Client.Team)
- {
- OnTeamChange(Client);
- }
- Team[Client.ClientNum] = Client.Team;
- }
- }
- }
- }
OnTeamChange will get called every time someone changes team.TESTED