server and client commands help!

can anyone help me here I am making a basic kick system for my small lanchat and I am having problems with abit of code I have my client and server working fine there both send and get the right name that I want to be kick from my chat however when there is more then 3 people in room it kicks everyone one of the room other then the person kicking can anyone help me out I pu both server and client codes below

SERVER
[code]
if command = 'KICKUSER' then
begin
username := GetByTab(egg,1); // gets username
if ListBox1.Items.IndexOf(username) >=0 then
Broadcast(Socket,'KICKUSEROFF'+chr(9)+username); sends username back to client to be kicked
Broadcast(Socket,'BKICKINGOFF');
end;
[/code]

CLIENT
[code]
procedure TForm1.Kick1Click(Sender: TObject);
begin
if loginname = lstMembers.Selected.Caption then
begin
// take no action
end
else
begin
if not assigned(lstMembers.Selected) then Exit;
if MessageDlg('Are you sure you want to kick '+ lstMembers.Selected.Caption, mtInformation, [mbYes, mbNo], 0) = mrYes then
begin
bkicking := True;
SendData('KICKUSER',lstMembers.Selected.Caption); // sends the user that is being kick to server
end;
end;
end;
[/code]

Reads info from server IE name to be kicked!

[code]
if (GetByTab(egg,0) = 'KICKUSEROFF') and (not bkicking) then
begin
bkicking := true; // I think it has sumthing to do with this I need to make everyone else in chat be true but the person that is being kick false.

Connect1.Enabled := True;
Disconnect1.Enabled := False;
Timer1.Enabled := False;
prefs.LabeledEdit2.Enabled := True;
prefs.LabeledEdit2.ReadOnly := False;
SendData('LOGOUT',GetByTab(egg,1)); // logoff the user that has been kicked
waveIn.close();
ClientSocket1.Socket.Close();
Application.MessageBox(PChar('You have just been kick by a room moderator.'), 'System Information', mb_Ok);
Exit;
end;
[/code]

hope you can help me!!!
Slewis
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories