02-27-2017, 03:31 PM
@Awiion, @PROGRAMMATOR
Когда меняю сторону выдает эту ошибку
Помогите пожалуйста.
Credits: Oz-Network
Когда меняю сторону выдает эту ошибку
Помогите пожалуйста.
PROTOCOL_ROOM_CHANGE_TEAM_ACK
[SRC="csharp"]class PROTOCOL_ROOM_CHANGE_TEAM_ACK : SendPacket
{
private Player p;
private Room room;
private SLOT leaderSlot;
private int cmd, slotcount, newTeam;
public PROTOCOL_ROOM_CHANGE_TEAM_ACK(Player player, Room room, int cmd, int slotcount, int newTeam)
{
this.p = player;
this.room = room;
this.cmd = cmd;
this.slotcount = slotcount;
this.newTeam = newTeam;
this.leaderSlot = room.getRoomSlotByPlayer(room.getLeader());
}
public override void WriteImpl()
{
WriteH(0xF25);
WriteC(0);
WriteC((byte)leaderSlot.getId());
WriteC((byte)slotcount);
if (slotcount > 1)
{
foreach (int slot in Room.RED_TEAM)
{
SLOT oldSlot = room.getRoomSlots()[slot];
SLOT newSlot = room.getRoomSlots()[slot + 1];
SLOT_STATE oldState = oldSlot.getState();
oldSlot.setState(newSlot.getState());
newSlot.setState(oldState);
Player oldPlayer = oldSlot.getPlayer();
oldSlot.setPlayer(newSlot.getPlayer());
newSlot.setPlayer(oldPlayer);
WriteC((byte)oldSlot.getId());
WriteC((byte)newSlot.getId());
WriteC((byte)(int)oldSlot.getState());
WriteC((byte)(int)newSlot.getState());
}
}
else
{
SLOT oldSlot = room.getRoomSlotByPlayer(p);
SLOT newSlot = room.changeTeam(p, newTeam);
WriteC((byte)oldSlot.getId());
WriteC((byte)newSlot.getId());
WriteC((byte)(int)oldSlot.getState());
WriteC((byte)(int)newSlot.getState());
}
}
}
}[/SRC]
{
private Player p;
private Room room;
private SLOT leaderSlot;
private int cmd, slotcount, newTeam;
public PROTOCOL_ROOM_CHANGE_TEAM_ACK(Player player, Room room, int cmd, int slotcount, int newTeam)
{
this.p = player;
this.room = room;
this.cmd = cmd;
this.slotcount = slotcount;
this.newTeam = newTeam;
this.leaderSlot = room.getRoomSlotByPlayer(room.getLeader());
}
public override void WriteImpl()
{
WriteH(0xF25);
WriteC(0);
WriteC((byte)leaderSlot.getId());
WriteC((byte)slotcount);
if (slotcount > 1)
{
foreach (int slot in Room.RED_TEAM)
{
SLOT oldSlot = room.getRoomSlots()[slot];
SLOT newSlot = room.getRoomSlots()[slot + 1];
SLOT_STATE oldState = oldSlot.getState();
oldSlot.setState(newSlot.getState());
newSlot.setState(oldState);
Player oldPlayer = oldSlot.getPlayer();
oldSlot.setPlayer(newSlot.getPlayer());
newSlot.setPlayer(oldPlayer);
WriteC((byte)oldSlot.getId());
WriteC((byte)newSlot.getId());
WriteC((byte)(int)oldSlot.getState());
WriteC((byte)(int)newSlot.getState());
}
}
else
{
SLOT oldSlot = room.getRoomSlotByPlayer(p);
SLOT newSlot = room.changeTeam(p, newTeam);
WriteC((byte)oldSlot.getId());
WriteC((byte)newSlot.getId());
WriteC((byte)(int)oldSlot.getState());
WriteC((byte)(int)newSlot.getState());
}
}
}
}[/SRC]
PROTOCOL_ROOM_CHANGE_TEAM_REQ
[SRC="csharp"]class PROTOCOL_ROOM_CHANGE_TEAM_REQ : ReceivePacket
{
private int team;
public PROTOCOL_ROOM_CHANGE_TEAM_REQ(GameNetwork Client, byte[] data)
{
makeme(Client, data);
}
public override void ReadImpl()
{
team = ReadD();
}
public override void RunImpl()
{
Room room = getClient().getPlayer().getRoom();
Player player = getClient().getPlayer();
getClient().SendPacket(new PROTOCOL_ROOM_CHANGE_TEAM_ACK(player, room, 0, 1, team));
foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values)
{
member.getClient().SendPacket(new PROTOCOL_ROOM_CHANGE_TEAM_ACK(getClient().getPlayer(), room, 0 , 1 , team));
member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room));
}
}
}
}
[/SRC]
{
private int team;
public PROTOCOL_ROOM_CHANGE_TEAM_REQ(GameNetwork Client, byte[] data)
{
makeme(Client, data);
}
public override void ReadImpl()
{
team = ReadD();
}
public override void RunImpl()
{
Room room = getClient().getPlayer().getRoom();
Player player = getClient().getPlayer();
getClient().SendPacket(new PROTOCOL_ROOM_CHANGE_TEAM_ACK(player, room, 0, 1, team));
foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values)
{
member.getClient().SendPacket(new PROTOCOL_ROOM_CHANGE_TEAM_ACK(getClient().getPlayer(), room, 0 , 1 , team));
member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room));
}
}
}
}
[/SRC]
Error pic1
Error pic2
Credits: Oz-Network