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

[L4D2] How to hook player connect without players from last chapter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-30-2018 , 19:31   [L4D2] How to hook player connect without players from last chapter
Reply With Quote #1

As the title mentions, I would like to have a hook similar to OnClientConnected only that it will exclude players that trigger this hook because they were in the last chapter and transition to the next one and not because they just joined the server from another server / game's main menu
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-02-2018 , 12:12   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #2

I've tried many methods, such as trying to mark players in OnClientDisconnected since some plugins seem to save it, 0 success, still trying to pull it out, any ideas?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 04-02-2018 , 20:10   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #3

show us the code your using in onclientconnected, i may know of a way depending on what your doing, i cant help until i better understand what your tryig to do, are u trying to block people from connecting on the next chapter or just preventing the code in onclientconnected from targeting them?
MasterMind420 is offline
pride95
Senior Member
Join Date: Aug 2015
Old 04-03-2018 , 15:00   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #4

userid.

if a client connects from lobby then userid++;
if a client connects from map change the old userid (from the previous map) == userid (from this map).

try to create a fakeclient onmapstart, get his userid and then check if userid from player connected > userid from fakeclient.

Last edited by pride95; 04-03-2018 at 15:01.
pride95 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-03-2018 , 16:50   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #5

Quote:
Originally Posted by pride95 View Post
userid.

if a client connects from lobby then userid++;
if a client connects from map change the old userid (from the previous map) == userid (from this map).

try to create a fakeclient onmapstart, get his userid and then check if userid from player connected > userid from fakeclient.
A bit confusing, can you demonstrate please or further explain? I don't understand almost everything.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 04-03-2018 at 16:51.
eyal282 is offline
pride95
Senior Member
Join Date: Aug 2015
Old 04-04-2018 , 06:43   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #6

PHP Code:

int IntMaxUserId
;

public 
void OnPluginStart()
{
    
HookEvent("player_connect_full"Event_PlayerConnect);
}

public 
void OnMapStart()
{
    
int Bot CreateFakeClient("Bot");
    
IntMaxUserid GetClientUserId(Bot);
    
KickClient(Bot);
}

public 
Action Event_PlayerConnect(Event event, const char[] namebool dontBroadcast
{
    
int Id event.GetInt("userid");
    
int Client GetClientOfUserId(Id);
    
    if(
Id IntMaxUserid)
    {
        ... 
connection from previous map
    
}

i don't know if the bot has some userid, but this is an idea. You should find a signature and use in gamedata (if exists) for connections from previous maps. If the players keep their userid on map change i think there should be a signature for this.
pride95 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 04-04-2018 , 07:19   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #7

Quote:
Originally Posted by pride95 View Post
PHP Code:

int IntMaxUserId
;

public 
void OnPluginStart()
{
    
HookEvent("player_connect_full"Event_PlayerConnect);
}

public 
void OnMapStart()
{
    
int Bot CreateFakeClient("Bot");
    
IntMaxUserid GetClientUserId(Bot);
    
KickClient(Bot);
}

public 
Action Event_PlayerConnect(Event event, const char[] namebool dontBroadcast
{
    
int Id event.GetInt("userid");
    
int Client GetClientOfUserId(Id);
    
    if(
Id IntMaxUserid)
    {
        ... 
connection from previous map
    
}

i don't know if the bot has some userid, but this is an idea. You should find a signature and use in gamedata (if exists) for connections from previous maps. If the players keep their userid on map change i think there should be a signature for this.
Use client serials instead they won't change, userid's increment on connect. You could even go as far as tracking the steam Id
MasterMind420 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 04-04-2018 , 08:07   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #8

Best solution would be creating an array, storing all the SteamIDs there (MasterMind's suggestion), and check for matches in the next level.
cravenge is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-04-2018 , 08:12   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #9

Quote:
Originally Posted by cravenge View Post
Best solution would be creating an array, storing all the SteamIDs there (MasterMind's suggestion), and check for matches in the next level.
Someone can disconnect during chapter change and reconnect.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 04-04-2018 , 08:54   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #10

The "reconnect to server" method should be pointless.
cravenge is offline
Reply



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 07:26.


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