Raised This Month: $ Target: $400
 0% 

[+] Simple Welcome Chat Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author
fat0nix
Junior Member
Join Date: Dec 2022
Location: Kosovo
Plugin ID:
8317
Plugin Version:
Plugin Category:
All
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Old 12-07-2022 , 09:27   [+] Simple Welcome Chat Message
    Reply With Quote #1

    Introduction
    This plugin welcomes the users that will join to your server

    ConVars
    sm_Join_Message - Sets the message to display when users join the server.


    Requirements
    SourceMod v1.11
    Colors.inc (It needs to compile)

    Installation
    You need to go to csgo/addons/sourcemod/plugins
    And put welcomechatmessage.smx to your plugins!

    -
    Please feel free to tell me what to update

    Supports

    -Colors
    -[SteamID]
    -[IP]
    -[COUNTRY]
    -[NAME]
    Attached Files
    File Type: sp Get Plugin or Get Source (welcomechatmessage.sp - 169 views - 1.5 KB)
    fat0nix is offline
    luanhai
    New Member
    Join Date: Dec 2022
    Old 12-07-2022 , 09:30   Re: [+] Simple Welcome Chat Message
    Reply With Quote #2

    Nice plugin tho
    Perfect job according to your code i see you used old code and you are mostly an amxmodx scripter converting to sourcemod

    Nice Work
    luanhai is offline
    Johnoclock
    Member
    Join Date: Oct 2014
    Location: denmark
    Old 12-07-2022 , 14:46   Re: [+] Simple Welcome Chat Message
    Reply With Quote #3

    i fixed the code to the new newdecls

    i remove some unused code too. it untested
    Code:
    #include <sourcemod>
    #include <colors>
    
    #pragma semicolon 1
    #pragma newdecls required
    
    Handle sm_Join_Message = INVALID_HANDLE;
    char Message[128];
    
    public Plugin myinfo =
    {
    	name = "Welcome Plugin CSGO",
    	author = "fat0nix",
    	description = "This is my first plugin and it shows message if an player joins your server",
    	version = "1.0",
    	url = "http://forums.alliedmods.net/showthread.php?t=187975"
    };
    
    public void OnPluginStart()
    {
    	sm_Join_Message = CreateConVar("sm_join_message", "Welcome {name}[{steamid}][{ip}], to ", "Join Message", FCVAR_NOTIFY);
    	AutoExecConfig(true, "onJoin");
    	HookEvent("player_activate", Player_Activated, EventHookMode_Post);
    }
    
    public Action Player_Activated(Handle event, const char[] name, bool dontBroadcast)
    {
    	int client = GetClientOfUserId(GetEventInt(event, "userid"));
    	CreateTimer(4.0, Timer_Welcome, client, TIMER_FLAG_NO_MAPCHANGE);
    }
    
    public Action Timer_Welcome(Handle timer, any client)
    {
    	if (IsClientConnected(client) && IsClientInGame(client))
    	{
    		GetConVarString(sm_Join_Message, Message, sizeof(Message));
    		char Name[128];
    		char SteamID[128];
    		char IP[128];
    		GetClientName(client, Name, sizeof(Name));
    		GetClientAuthId(client, AuthId_Engine, SteamID, sizeof(SteamID));
    		GetClientIP(client, IP, sizeof(IP));
    		ReplaceString(Message, sizeof(Message), "{name}", Name, false);
    		ReplaceString(Message, sizeof(Message), "{steamid}", SteamID, false);
    		ReplaceString(Message, sizeof(Message), "{ip}", IP, false);
    		CPrintToChat(client, Message, client);
    	}
    }
    __________________
    Steam: johnoclock | Discord: Johnoclock#0730

    Last edited by Johnoclock; 12-07-2022 at 14:47.
    Johnoclock is offline
    fat0nix
    Junior Member
    Join Date: Dec 2022
    Location: Kosovo
    Old 12-08-2022 , 18:09   Re: [+] Simple Welcome Chat Message
    Reply With Quote #4

    Oh hi John i appreciate your help! im an amxmodx scripter and im trying to learn sourcemod so thank you
    fat0nix is offline
    alasfourom
    Senior Member
    Join Date: Feb 2022
    Location: Saudi Arabia
    Old 12-10-2022 , 21:05   Re: [+] Simple Welcome Chat Message
    Reply With Quote #5

    I'm not sure if all games can use this event, some undetectable changes xd

    PHP Code:
    #include <sourcemod>
    #include <colors>

    #pragma semicolon 1
    #pragma newdecls required
    #define PLUGIN_VERSION "1.0"

    ConVar g_Cvar_PluginEnable;
    ConVar g_Cvar_WelcomeTexts;

    public 
    Plugin myinfo =
    {
        
    name "Welcome Plugin",
        
    author "fat0nix",
        
    description "This is my first plugin and it shows message if an player joins your server",
        
    version "1.0",
        
    url "http://forums.alliedmods.net/showthread.php?t=187975"
    };

    public 
    void OnPluginStart() 
    {
        
    CreateConVar ("simple_weclome_chat_message"PLUGIN_VERSION"Simple Welcome Chat Message"FCVAR_SPONLY FCVAR_NOTIFY FCVAR_DONTRECORD);
        
    g_Cvar_PluginEnable CreateConVar("welcome_message_enable""1""Enable Welcome Message Plugin"FCVAR_NOTIFYtrue0.0true1.0);
        
    g_Cvar_WelcomeTexts CreateConVar("welcome_text_message""{default}Welcome {blue}{name} {olive}[{steamid}] {green}[{ip}] {default}To The Server.""Type Your Welcome Message"FCVAR_NOTIFY);
        
    AutoExecConfig(true"Simple_Welcome_Chat_Message");

        
    HookEvent("player_connect_full"Event_PlayerConnect);
    }

    void Event_PlayerConnect(Event event, const char[] namebool dontBroadcast
    {
        
    int client GetClientOfUserId(event.GetInt("userid"));
        if(!
    client || !IsClientInGame(client) || IsFakeClient(client) || !g_Cvar_PluginEnable.BoolValue) return;
        
        
    CreateTimer(5.0Timer_WelcomeTextclientTIMER_FLAG_NO_MAPCHANGE);
    }

    Action Timer_WelcomeText(Handle timerint client)
    {
        if (!
    IsClientInGame(client)) return Plugin_Stop;
        
        
    char sMessage[512];
        
    char sName[MAX_NAME_LENGTH];
        
    char sSteamID[32];
        
    char sIP[32];
        
        
    g_Cvar_WelcomeTexts.GetString(sMessagesizeof(sMessage));
        
        
    GetClientName(clientsNamesizeof(sName));
        
    GetClientAuthId(clientAuthId_Steam2sSteamIDsizeof(sSteamID));
        
    GetClientIP(clientsIPsizeof(sIP));
        
        
    ReplaceString(sMessagesizeof(sMessage), "{name}"sNamefalse);
        
    ReplaceString(sMessagesizeof(sMessage), "{steamid}"sSteamIDfalse);
        
    ReplaceString(sMessagesizeof(sMessage), "{ip}"sIPfalse);
        
        
    CPrintToChat(clientsMessage);
        return 
    Plugin_Handled;

    __________________

    Last edited by alasfourom; 12-10-2022 at 21:31.
    alasfourom is offline
    BloodyBlade
    Senior Member
    Join Date: Feb 2018
    Old 12-18-2022 , 04:15   Re: [+] Simple Welcome Chat Message
    Reply With Quote #6

    Code:
    #pragma semicolon 1
    #pragma newdecls required
    #include <sourcemod>
    #include <colors>
    
    #define CVAR_FLAGS FCVAR_NOTIFY
    #define PLUGIN_VERSION "1.0"
    
    ConVar sm_Join_Message;
    char Message[128];
    
    public Plugin myinfo =
    {
    	name = "Welcome Plugin",
    	author = "fat0nix",
    	description = "This is my first plugin and it shows message if an player joins your server",
    	version = PLUGIN_VERSION,
    	url = "http://forums.alliedmods.net/showthread.php?t=187975"
    };
    
    public void OnPluginStart()
    {
    	CreateConVar ("sm_welcome_chat_message", PLUGIN_VERSION, "Simple Welcome Chat Message", CVAR_FLAGS|FCVAR_SPONLY|FCVAR_DONTRECORD);
    	sm_Join_PluginEnable = CreateConVar("sm_welcome_message_enable", "1", "Enable Welcome Message Plugin", CVAR_FLAGS, true, 0.0, true, 1.0);
    	sm_Join_Message = CreateConVar("sm_welcome_message", "{default}Welcome {blue}{name} {olive}[{steamid}] {green}[{ip}] {default}to {blue}{hostname}", "Join Message", CVAR_FLAGS);
    	AutoExecConfig(true, "onJoin");
    }
    
    public void OnClientPutInServer(int client)
    {
    	if(sm_Join_PluginEnable.BoolValue)
    	{
    		if(!IsFakeClient(client))
    		{
    			CreateTimer(3.0, Timer_Welcome, client, TIMER_FLAG_NO_MAPCHANGE);
    		}
    	}
    }
    
    public Action Timer_Welcome(Handle timer, any client)
    {
    	if (client && IsClientInGame(client))
    	{
    		sm_Join_Message.GetString(Message, sizeof(Message));
    		FindConVar("hostname").GetString(host_name, 128);
    		char Name[128], SteamID[64], IP[64], host_name[128];
    		GetClientAuthId(client, AuthId_Steam2, user_steamid, 64);
    		GetClientName(client, user_name, 64);
    		GetClientIP(client, user_IP, sizeof(user_IP));
    		ReplaceString(Message, sizeof(Message), "{name}", Name, false);
    		ReplaceString(Message, sizeof(Message), "{steamid}", SteamID, false);
    		ReplaceString(Message, sizeof(Message), "{ip}", IP, false);
    		ReplaceString(Message, sizeof(Message), "{hostname}", host_name, false);
    		CPrintToChat(client, Message);
    	}
    	return Plugin_Stop;
    }
    BloodyBlade 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 20:57.


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