ForwardClient

From Soldat Community Wiki
Jump to: navigation, search

Scripting Manual Style

procedure ForwardClient(SrcIP: string; SrcPort: integer; TargetIP: string; TargetPort: integer; Message: string);

Parameter Info:
 SrcIP (String): Player IP
 SrcPort (Integer): Player port
 TargetIP (String): Server IP to redirect to
 TargetPort (Integer): Server port to redirect to
 Message (String): Message to be displayed in the client popup

Description:
 Disconnects a player, fills in the IP and port slots, and asks if they want to join the server.

Note: You can get the SrcPort of a connected player using GetPlayerStat(ID, 'port').

Note: TargetIP must be an IP address, hostnames don't work.

Examples

function OnRequestGame(IP: string; State: integer): integer;
begin
  // ask the person who join to join 127.0.0.1:23074, with a message for him
  ForwardClient(IP, 23073, '127.0.0.1', 23074, 'Join this server instead!');
  Result := State;
end;