Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-29-2018 , 15:08   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #21

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.
I doubt bots having user ids, because I can't recall an event giving user id of a bot, but I don't care about bots.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-29-2018 , 16:19   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #22

Quote:
Originally Posted by eyal282 View Post
I doubt bots having user ids, because I can't recall an event giving user id of a bot, but I don't care about bots.
All events should pass a userid for all bots which are clients, including SI bots and tanks. If you want to specifically get a bots userid either do IsFakeClient(client) within the event for just bots or use bot_replace_player or player_replace_bot events to get the bots userid specifically. I've yet to not see a bot trigger an event, but who knows.

Last edited by MasterMind420; 05-29-2018 at 16:20.
MasterMind420 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-30-2022 , 15:36   Re: [L4D2] How to hook player connect without players from last chapter
Reply With Quote #23

PHP Code:
stock bool IsClientNew(int client)
{
    return 
IsFakeClient(client) || GetGameTime() > GetClientTime(client);

from smac_stocks.inc
__________________
Ilusion9 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 10:00.


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