Raised This Month: $ Target: $400
 0% 

Solved I need help with L4D2 script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jes
Junior Member
Join Date: Aug 2024
Old 09-09-2024 , 06:51   I need help with L4D2 script
Reply With Quote #1

I got a plugin to define specific player as VIP, now I want to add a function to inform others when a VIP join, as follow:

PHP Code:
public OnClientConnected(int client)
{
    if (
VipPlayer(client) && IsFakeClient(client))
    {
        return;
    }
        
CPrintToChatAll("{lightgreen} [★VIP★] {blue}%N {default}has {lightgreen}descended"client);
        
EmitSoundToAll("level/loud/climber.wav"client);      

I got a function to check VipPlayer already, I just need help with these lines, Tysm

Last edited by Jes; 09-13-2024 at 04:43.
Jes is offline
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 09-09-2024 , 08:55   Re: I need help with L4D2 script
Reply With Quote #2

What exactly do you need help with? If you specifically need to play with this array, then it can be improved like this, I guess...
PHP Code:
public OnClientConnected(int client)
{
    
// Проверка, является ли игрок VIP и не является ли ботом
    
if (VipPlayer(client) && !IsFakeClient(client))
    {
        
// Отправляем сообщение всем игрокам
        
CPrintToChatAll("{lightgreen} [★VIP★] {blue}%N {default}has {lightgreen}descended"client);
        
        
// Воспроизводим звук для всех игроков
        
EmitSoundToAll("level/loud/climber.wav");
    }

__________________
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob
Jes
Junior Member
Join Date: Aug 2024
Old 09-12-2024 , 06:43   Re: I need help with L4D2 script
Reply With Quote #3

Quote:
Originally Posted by L4D2Noob View Post
What exactly do you need help with? If you specifically need to play with this array, then it can be improved like this, I guess...
PHP Code:
public OnClientConnected(int client)
{
    
// Проверка, является ли игрок VIP и не является ли ботом
    
if (VipPlayer(client) && !IsFakeClient(client))
    {
        
// Отправляем сообщение всем игрокам
        
CPrintToChatAll("{lightgreen} [★VIP★] {blue}%N {default}has {lightgreen}descended"client);
        
        
// Воспроизводим звук для всех игроков
        
EmitSoundToAll("level/loud/climber.wav");
    }

Somehow it does not print for me as the first one to join server (dedicated)
Jes is offline
Paimon
Member
Join Date: Jul 2021
Location: Zootopia
Old 09-12-2024 , 09:07   Re: I need help with L4D2 script
Reply With Quote #4

Quote:
Originally Posted by Jes View Post
Somehow it does not print for me as the first one to join server (dedicated)
OnClientConnected was called immediately when a client connect to server succeeded, at the time player didnt join in the server so this player couldnt see the message.

To solve it, replace OnClientConnected with OnClientPostAdminCheck.
__________________

Last edited by Paimon; 09-12-2024 at 09:09.
Paimon is offline
Reply


Thread Tools
Display Modes

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 13:32.


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