Notes
![]() ![]() Notes - notes.io |
#include <SteamWorks>
#include <store>
#pragma newdecls required
ConVar iGroupID,
PlayerCredits,
SpecCredits,
group_adverts,
CreditsTime;
Handle TimeAuto = null;
bool b_IsMember[MAXPLAYERS+1],
i_advert[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Steam Group Credits",
author = "Xines",
description = "Deals x amount of credits per x amount of secounds",
version = "1.2",
url = ""
};
public void OnPluginStart()
{
//Chat print on/off for all players
group_adverts = CreateConVar("sm_group_enable_adverts", "1", "Enables/Disables notifications for all in chat (1=On/0=Off)", FCVAR_PLUGIN|FCVAR_NOTIFY, true, 0.0, true, 1.0);
//Chat print on/off Client
RegConsoleCmd("sm_sgc", SgcCmd, "(On/Off) Steam Group Credits, Client Announcements");
//Configs
iGroupID = CreateConVar("sm_groupid_add", "0000000", "Steam Group ID (Replace with yours)", FCVAR_PLUGIN|FCVAR_NOTIFY);
PlayerCredits = CreateConVar("sm_group_credits", "5", "Credits to give per X time, if player is in group.", FCVAR_PLUGIN|FCVAR_NOTIFY);
SpecCredits = CreateConVar("sm_group_spec_credits", "2", "Spectate Credits to give per X time, if player is in group and spectate.", FCVAR_PLUGIN|FCVAR_NOTIFY);
CreditsTime = CreateConVar("sm_group_credits_time", "60", "Time in seconds to deal credits.", FCVAR_PLUGIN|FCVAR_NOTIFY);
//Don't Touch
HookConVarChange(CreditsTime, Change_CreditsTime);
}
public void OnMapStart()
{
TimeAuto = CreateTimer(CreditsTime.FloatValue, CheckPlayers, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public Action CheckPlayers(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i)) addcredits(i);
return Plugin_Continue;
}
void addcredits(int client)
{
if(b_IsMember[client]) //Is member
{
//Get Player Credit Buffer!
int pcredits = PlayerCredits.IntValue;
//If spectate set new value of credits
if(GetClientTeam(client) == 1) pcredits = SpecCredits.IntValue;
//Give Credits
Store_SetClientCredits(client, Store_GetClientCredits(client) + pcredits);
//Print to client
if(group_adverts.BoolValue && i_advert[client])
PrintToChat(client, "x01[SM] You received x04%ix01 credits for being member in our x04steam group!", pcredits);
}
}
public void OnClientPostAdminCheck(int client)
{
i_advert[client] = true;
b_IsMember[client] = false;
SteamWorks_GetUserGroupStatus(client, iGroupID.IntValue);
}
public int SteamWorks_OnClientGroupStatus(int authid, int groupAccountID, bool isMember, bool isOfficer)
{
int client = UserAuthGrab(authid);
if (client != -1 && isMember) b_IsMember[client] = true;
return;
}
int UserAuthGrab(int authid)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i))
{
char charauth[64], authchar[64];
GetClientAuthId(i, AuthId_Steam3, charauth, sizeof(charauth));
IntToString(authid, authchar, sizeof(authchar));
if(StrContains(charauth, authchar) != -1) return i;
}
}
return -1;
}
public void Change_CreditsTime(Handle cvar, const char[] oldVal, const char[] newVal)
{
if (TimeAuto != null)
{
KillTimer(TimeAuto);
TimeAuto = null;
}
TimeAuto = CreateTimer(CreditsTime.FloatValue, CheckPlayers, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
public Action SgcCmd(int client, int args)
{
if (group_adverts.BoolValue)
{
//Do Prints
if(!i_advert[client]) PrintToChat(client, "x04[x01Steam Group Creditsx04] x01Announcements x04[ON]");
else PrintToChat(client, "x04[x01Steam Group Creditsx04] x01Announcements x04[OFF]");
//Reverse Bool
i_advert[client] = !i_advert[client];
}
return Plugin_Handled;
}
stock bool IsValidClient(int client)
{
return (1 <= client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client));
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team