Difference between revisions of "TGame.OnRequest"
m |
(2.7.8.b1 declaration change) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
Event handler type: [[TOnRequestEvent]] | Event handler type: [[TOnRequestEvent]] | ||
Event handler declaration: | Event handler declaration: | ||
− | function ('''Ip''': string; '''Port''': Word; '''State''': Byte; '''Forwarded''': Boolean; '''Password''': string): Integer; | + | function ('''Ip''', '''Hw''': string; '''Port''': Word; '''State''': Byte; '''Forwarded''': Boolean; '''Password''': string): Integer; |
==Description== | ==Description== | ||
Line 30: | Line 30: | ||
Example allows players to join even if they enter wrong password | Example allows players to join even if they enter wrong password | ||
<syntaxhighlight lang="pascal"> | <syntaxhighlight lang="pascal"> | ||
− | function MyOnRequestHandler(Ip: string; Port: Word; State: Byte; Forwarded: Boolean; Password: string): Integer; | + | function MyOnRequestHandler(Ip, Hw: string; Port: Word; State: Byte; Forwarded: Boolean; Password: string): Integer; |
begin | begin | ||
if (State = 3) then | if (State = 3) then | ||
Line 50: | Line 50: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | [[Category:TGame]] | + | [[Category:TGame]][[Category:Events]] |
Latest revision as of 10:35, 4 October 2014
property OnRequest Access mode: RW Event handler type: TOnRequestEvent Event handler declaration: function (Ip, Hw: string; Port: Word; State: Byte; Forwarded: Boolean; Password: string): Integer;
Description
Event property called when a player connects with a server in order to join.
State Value | Description |
---|---|
1 | OK |
2 | Wrong Soldat version |
3 | Wrong password |
4 | Banned |
5 | Server full |
6 | Duplicate IP |
Example
Example allows players to join even if they enter wrong password
function MyOnRequestHandler(Ip, Hw: string; Port: Word; State: Byte; Forwarded: Boolean; Password: string): Integer;
begin
if (State = 3) then
State := 1;
Result := State;
end;
// ...
begin
// assign OnRequest handler
Game.OnRequest := @MyOnRequestHandler;
// ...
// unassign
Game.OnRequest := nil;
end;