Raised This Month: $32 Target: $400
 8% 

My first plug-in


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FeelsGoodMan
Member
Join Date: Jul 2015
Old 03-23-2017 , 03:53   My first plug-in
Reply With Quote #1

So i am trying to make my first ever plug-in, but i just can't figure out why it's not working. It is supposed to exec the command sm_invite on all new connecting clients. Here is my code so far:

Code:
#include <sourcemod>
 
public Plugin myinfo =
{
	name = "Inviter",
	author = "Dream / HellonEarth",
	description = "executes the command sm_invite on all new connecting clients",
	version = "1.0",
	url = "https://hoecommunity.com"
};


public OnClientPutInServer(int client)
{
    new String:SteamID[50];
    GetClientAuthString(client, SteamID, 50);
    if (StrEqual(SteamID, "STEAM_ID:H:ERE", false))
    {
        ServerCommand("sm_invite #%i 10", GetClientUserId(client)); 
    }
}
__________________
Server and web developer in -=Hell on Earth=- multi gaming community.

PM me or add me on STEAM for assistance with web development (MyBB, wordpress, PhPBB etc.)

Last edited by FeelsGoodMan; 03-23-2017 at 04:02.
FeelsGoodMan is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 03-23-2017 , 05:04   Re: My first plug-in
Reply With Quote #2

then the check is not needed?
Code:
public OnClientPutInServer(int client)
{
    new String:SteamID[50];
    GetClientAuthString(client, SteamID, 50);
    if (StrEqual(SteamID, "STEAM_ID:H:ERE", false))
    {
        ServerCommand("sm_invite #%i 10", GetClientUserId(client)); 
    }
}
-->
Code:
public OnClientPutInServer(int client)
{
    ServerCommand("sm_invite #%i 10", GetClientUserId(client));    
}
TheDS1337 is offline
FeelsGoodMan
Member
Join Date: Jul 2015
Old 03-23-2017 , 05:24   Re: My first plug-in
Reply With Quote #3

Quote:
Originally Posted by DeagLe.Studio View Post
then the check is not needed?
Code:
public OnClientPutInServer(int client)
{
    new String:SteamID[50];
    GetClientAuthString(client, SteamID, 50);
    if (StrEqual(SteamID, "STEAM_ID:H:ERE", false))
    {
        ServerCommand("sm_invite #%i 10", GetClientUserId(client)); 
    }
}
-->
Code:
public OnClientPutInServer(int client)
{
    ServerCommand("sm_invite #%i 10", GetClientUserId(client));    
}
This didn't solve it. It made the code more efficient probably but it's not executing the command.
__________________
Server and web developer in -=Hell on Earth=- multi gaming community.

PM me or add me on STEAM for assistance with web development (MyBB, wordpress, PhPBB etc.)
FeelsGoodMan is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 03-23-2017 , 06:11   Re: My first plug-in
Reply With Quote #4

what does this command do ? "sm_invite"
TheDS1337 is offline
FeelsGoodMan
Member
Join Date: Jul 2015
Old 03-23-2017 , 06:14   Re: My first plug-in
Reply With Quote #5

Sends a steam group invite to target client. The command works, the script i wrote doesn't
__________________
Server and web developer in -=Hell on Earth=- multi gaming community.

PM me or add me on STEAM for assistance with web development (MyBB, wordpress, PhPBB etc.)

Last edited by FeelsGoodMan; 03-23-2017 at 06:15.
FeelsGoodMan is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 03-23-2017 , 06:39   Re: My first plug-in
Reply With Quote #6

PHP Code:
#include <sourcemod>
  
public Plugin myinfo =
{
    
name "Inviter",
    
author "Dream / HellonEarth",
    
description "executes the command sm_invite on all new connecting clients",
    
version "1.0",
    
url "https://hoecommunity.com"
};
public 
OnClientPutInServer(int client)
{
  
char playerid[20]
 
GetClientAuthId(clientAuthId_Steam2playerid20);
  
  if (
StrEqual(playerid"STEAM_ID:H:ERE"false))
    {
         
ServerCommand("sm_invite #%i 10"playerid); 
    }

You haven't actually defined the sm_invite command so there is no point in using that? I'd suggest just taking a look at Franc1sco's webshortcuts and just adding an !group command providing this is a CS:GO command lol.

Failing that just create an invite bot for Steam and push the Steam64ID's of connecting players through it.
__________________

Last edited by B3none; 03-23-2017 at 06:40.
B3none is offline
good_live
AlliedModders Donor
Join Date: Oct 2013
Old 03-23-2017 , 06:46   Re: My first plug-in
Reply With Quote #7

The command should get executed. There is no problem with the code.
You should use OnClientPostAdminCheck if you're command is relying on a steamid:
"Whether a client has a steamid is undefined until OnClientAuthorized is called, which may occur either before or after OnClientPutInServer. Similarly, use OnClientPostAdminCheck() if you need to verify whether connecting players are admins."

However auto inviting any joining player without asking them is against Valves TOS.

Last edited by good_live; 03-23-2017 at 06:48.
good_live is offline
FeelsGoodMan
Member
Join Date: Jul 2015
Old 03-23-2017 , 07:11   Re: My first plug-in
Reply With Quote #8

Quote:
Originally Posted by good_live View Post
The command should get executed. There is no problem with the code.
You should use OnClientPostAdminCheck if you're command is relying on a steamid:
"Whether a client has a steamid is undefined until OnClientAuthorized is called, which may occur either before or after OnClientPutInServer. Similarly, use OnClientPostAdminCheck() if you need to verify whether connecting players are admins."

However auto inviting any joining player without asking them is against Valves TOS.
I'm not 100% sure what I'm doing wrong here. When i do sm_invite name in the console nothing happens, but when i do the same command from the in-game console in my game client it works fine.

The code i used didn't work btw. I just recompiled the plug-in with OnClientPostAdminCheck() so i will see what happens then.
__________________
Server and web developer in -=Hell on Earth=- multi gaming community.

PM me or add me on STEAM for assistance with web development (MyBB, wordpress, PhPBB etc.)
FeelsGoodMan is offline
B3none
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 03-23-2017 , 08:57   Re: My first plug-in
Reply With Quote #9

Quote:
Originally Posted by good_live View Post
However auto inviting any joining player without asking them is against Valves TOS.
If you get enough attention might this lead to a GSLT ban?
__________________
B3none is offline
FeelsGoodMan
Member
Join Date: Jul 2015
Old 03-23-2017 , 09:21   Re: My first plug-in
Reply With Quote #10

Quote:
Originally Posted by b3none View Post
If you get enough attention might this lead to a GSLT ban?
There are some common misconceptions when it comes to what you can be GSLT banned for and not. Some of it is false and hearsay, while some of it is legit. Normally it revolves around teporarily falsifying information about your inventory or your clients inventory.

I use those two links for reference:

http://store.steampowered.com/subscriber_agreement/
http://blog.counter-strike.net/index...er_guidelines/

If you follow this you should pretty much be in the green zone. I see nothing that disallows this as the users who receives the invites are perfectly able to just click "ignore". Motd ads should be more in the grey zone if you ask me considering you actually gain revenue from a third party using valve's content as a direct medium, but you don't see valve handing out GSLT bans for that.

TL;DR: As long as Valve doesn't lose profit you're good.

Quote:
Originally Posted by good_live View Post
However auto inviting any joining player without asking them is against Valves TOS.
You don't normally ask for permission when inviting people to steam groups anyway


Attaching the sp file i am basing this plug-in off.
Blocked Attachments
File Type: sp inviter.sp
File Type: inc steamcore.inc
__________________
Server and web developer in -=Hell on Earth=- multi gaming community.

PM me or add me on STEAM for assistance with web development (MyBB, wordpress, PhPBB etc.)

Last edited by FeelsGoodMan; 03-23-2017 at 10:24.
FeelsGoodMan 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 21:41.


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