Raised This Month: $51 Target: $400
 12% 

[L4D2] ConnectHook


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
spumer
Senior Member
Join Date: Aug 2011
Old 12-12-2015 , 08:59   [L4D2] ConnectHook
Reply With Quote #1

This extension provides a OnClientPreConnect forward (similar to CBaseServer's, and Connect).

Unlike the Connect extension this version supports Left 4 Dead 2 game, but no SteamID validation (engine restrictions).

Unlike the CBaseServer extension this version provides more clear interface to reject clients.

PHP Code:
/**
 * @brief Called very early in the client connect process
 *
 * @param name          Client's name.
 * @param password      Connection password (or the most recently used one).
 * @param ip            Client's IP address.
 * @param steamID       Client's SteamId.  (This is before authentication so it is not guaranteed.)
 * @param rejectReason  Client's connection reject reason. Will be used only if returned action is Plugin_Handled or above.
 */
forward Action:OnClientPreConnect(const String:name[], const String:password[], const String:ip[], const String:steamID[], String:rejectReason[255]); 
You also can use standard "presets" of kick reasons. For example, restrict any connections to the server:

PHP Code:
public Action:OnClientPreConnect(const String:name[], const String:password[], const String:ip[], const String:steamID[], String:rejectReason[255])
{
        
PrintToServer("Name=%s, password=%s, IP=%s, steamID=%s"namepasswordipsteamID);
        
FormatEx(rejectReasonsizeof(rejectReason), "%s""#Valve_Reject_Server_Full");
        return 
Plugin_Stop;

Full example you can see in scripting/test_onclientpreconnect.sp
Attached Files
File Type: gz ConnectHook.tar.gz (15.5 KB, 997 views)
File Type: so connecthook.ext.2.l4d2.so (56.0 KB, 494 views)
__________________

Last edited by spumer; 12-12-2015 at 09:00.
spumer is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode