Raised This Month: $ Target: $400
 0% 

Solved Simple message on user connect help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
FuZ!on
Senior Member
Join Date: Aug 2007
Old 10-05-2019 , 09:49   Simple message on user connect help
Reply With Quote #1

Hi,

It's been way too long and I'm looking to get back into the AlliedModders community. Always did some stuff with AMXx and never SourceMod so this is all new to me.

I started off with a small plugin by following a tutorial I found online that will trigger a message when a user connects to the server that displays the client's name and steam ID. The tutorial is a bit outdated and uses the GetClientAuthString method.

Here is the original code:

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "Tutorial",
    
author "FuZ!oN",
    
description "Display connect message",
    
url ""
};

public 
OnClientPutInServer(client)
{
    new 
String:name[32], String:authid[32];
    
    
GetClientName(clientnamesizeof(name));
    
GetClientAuthString(clientauthidsizeof(authid));
    
    
PrintToChatAll("\x01[SM] \x04%s\x01 (\x05%s\x01) has joined."nameauthid);

Compiles with a warning about the GetClientAuthString which is understandable but still works. Only thing is, it doesn't appear to display a message for myself when I join the server, only bots: https://i.imgur.com/I7D8PhM.png

I did some research and changed my code around to this:

PHP Code:
#include <sourcemod>

public Plugin:myinfo = {
    
name "Tutorial",
    
author "Tim",
    
description "This is a simple tutorial",
    
url ""
};

public 
OnClientPutInServer(client)
{
    
char authid[32], name[64];
    
    
GetClientName(clientnamesizeof(name));
    
GetClientAuthId(clientAuthId_Steam2authidsizeof(authid));
    
    
PrintToChatAll("\x01[SM] \x04%s\x01 (\x05%s\x01) has joined."nameauthid);

Compiles without warnings or errors but still have the same result as above.

Any help would be greatly appreciated so I can continue on my way

EDIT:

I just thought that maybe I'm too late to see the message because it's displayed before I spawn? I haven't been able to test it yet with another friend.

Last edited by FuZ!on; 10-05-2019 at 13:13.
FuZ!on is offline
 



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:11.


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