Raised This Month: $ Target: $400
 0% 

Custom Welcome message to all


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bouncer
Veteran Member
Join Date: Apr 2009
Old 10-11-2010 , 17:51   Custom Welcome message to all
Reply With Quote #1

I need a plugin that has cvars to enable/disable text in chat/hint.

When a player with custom flag O joins the server, it prints in chat/hint

"Welcome Premium Gamer Namehere"
__________________


bouncer is offline
Devzirom
Junior Member
Join Date: Dec 2008
Location: Russian Federation
Old 10-20-2010 , 04:51   Re: Custom Welcome message to all
Reply With Quote #2

PHP Code:
#include <sourcemod>

new Handle:sm_wp_enabled;

public 
Plugin:myinfo = {
    
name "Welcome Premium",
    
author "",
    
description "",
    
version "1.0",
    
url "www.sourcemod.com"
}

public 
OnPluginStart() {
    
sm_wp_enabled CreateConVar("sm_wp_enabled""1""\"1\" = \"Welcome Premium\" plugin is active, \"0\" = \"Welcome Premium\" plugin is disabled");
}

public 
OnClientPutInServer(client) {
    if(
GetConVarInt(sm_wp_enabled) != 1)
        return;
    
    if(
GetUserFlagBits(client) & (ADMFLAG_CUSTOM1)) {
        
PrintToChat(client"Welcome Premium Gamer Namehere");
    }
    
    return;

Devzirom is offline
bouncer
Veteran Member
Join Date: Apr 2009
Old 10-20-2010 , 16:32   Re: Custom Welcome message to all
Reply With Quote #3

Does this print it to ALL players or just him? I want it to print to all players on both teams.
__________________


bouncer is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-20-2010 , 16:51   Re: Custom Welcome message to all
Reply With Quote #4

Quote:
Originally Posted by bouncer View Post
Does this print it to ALL players or just him? I want it to print to all players on both teams.
PrintToChatAll("Welcome Premium Gamer Namehere");
Bacardi is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 10-23-2010 , 03:38   Re: Custom Welcome message to all
Reply With Quote #5

Instead of PrintToChat(client, "Welcome Premium Gamer Namehere");
You can use
PrintToChatAll("Welcome, Premium Gamer %N", client);
You can even make them colored by using \x0# in front of the piece you want colored.
PrintToChatAll("Welcome, \x04Premium Gamer \x05%N\x01", client);
\x01 is default color, \x04 is Green, \x03 is a team color, \x05 is olive.
%N makes a name, but never put %N with a server command, only with printing to chat. Otherwise clients can change their name to "lol; _restart", then the server will try to read their name and make it a command, and... bad things happen.

Basically, use one of the two bolded lines in place of the underlined line.

EDIT: That enable cvar line seems to be strange or complicated, nor will it work right if you turn it off in the middle of somebody joining or something.
Try this:
PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "Welcome Premium",
    
author "",
    
description "",
    
version "1.0",
    
url "www.sourcemod.com"
}

public 
OnPluginStart()
{
    
CreateConVar("sm_wp_enabled""1""\"1\" = \"Welcome Premium\" plugin is active, \"0\" = \"Welcome Premium\" plugin is disabled"FCVAR_PLUGIN FCVAR_NOTIFY FCVAR_REPLICATED);
}

public 
OnClientPutInServer(client)
{
    if (
GetConVarBool(FindConVar("sm_wp_enabled")) && (GetUserFlagBits(client) & ADMFLAG_CUSTOM1))
        
CreateTimer(30.0PremiumJoinAnnounceany:client);
}
public 
Action:PremiumJoinAnnounce(Handle:timerany:client)
{
    
PrintToChatAll("Welcome, \x04Premium Gamer \x05%N\x01"client);

It will also only announce to others 30 seconds after the player joins the game (finishes loading and is at the MOTD), so that he can see it too
__________________
Bread EOTL GunMettle Invasion Jungle Inferno 64-bit will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 10-23-2010 at 03:49.
FlaminSarge 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 21:19.


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