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(client, name, sizeof(name));
GetClientAuthString(client, authid, sizeof(authid));
PrintToChatAll("\x01[SM] \x04%s\x01 (\x05%s\x01) has joined.", name, authid);
}
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(client, name, sizeof(name));
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
PrintToChatAll("\x01[SM] \x04%s\x01 (\x05%s\x01) has joined.", name, authid);
}
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.