Raised This Month: $12 Target: $400
 3% 

[REQ] Free Credits To Vip In Zeph Store


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bolimha
New Member
Join Date: Dec 2019
Old 05-05-2020 , 16:33   [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #1

Hello,
I was wondering if someone can make a plugin that with a timer, can give credits to a player that have the flags "aost", i have this code from another thread of an plugin, if that be usefull.

Code:
#include <sourcemod>
#include <SteamWorks>
#include <store>

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.3",
	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_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_NOTIFY);
	PlayerCredits = CreateConVar("sm_group_credits", "5", "Credits to give per X time, if player is in group.", FCVAR_NOTIFY);
	SpecCredits = CreateConVar("sm_group_spec_credits", "2", "Spectate Credits to give per X time, if player is in group and spectate.", FCVAR_NOTIFY);
	CreditsTime = CreateConVar("sm_group_credits_time", "60", "Time in seconds to deal credits.", FCVAR_NOTIFY);
	
	//Don't Touch
	HookConVarChange(CreditsTime, Change_CreditsTime);
}

public void OnMapStart()
{
	TimeAuto = CreateTimer(CreditsTime.FloatValue, CheckPlayers, _, TIMER_REPEAT);
}

public Action CheckPlayers(Handle timer)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		addcredits(i);
	}
	return Plugin_Continue;
}

void addcredits(int client)
{
	if(IsClientInGame(client) && b_IsMember[client]) //ingame + 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%i\x01 credits for being member in our \x04steam group!", pcredits);
		}
	}
}

public void OnClientPostAdminCheck(int client)
{
	i_advert[client] = true;
	b_IsMember[client] = false;
	if(!SteamWorks_GetUserGroupStatus(client, iGroupID.IntValue))
	{
		LogError("[SGC] Could not get user group for user: %N", client);
	}
}

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)
{
	char charauth[64], authchar[64];
	for (int i = 1; i <= MaxClients; i++)
	{
		if(IsClientInGame(i) && 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)
{
	delete TimeAuto;
	TimeAuto = CreateTimer(CreditsTime.FloatValue, CheckPlayers, _, TIMER_REPEAT);
}

public Action SgcCmd(int client, int args)
{
	if (group_adverts.BoolValue)
	{
		//Reverse Bool
		i_advert[client] = !i_advert[client];
		
		//Do Prints
		PrintToChat(client, "​\x04[\x01Steam Group Credits\x04] \x01Announcements \x04%s", i_advert[client] ? "[ON]":"[OFF]");
	}
	return Plugin_Handled;
}
Thanks,
b0limh4
Bolimha is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 05-07-2020 , 11:35   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #2

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

ConVar g_cvCredits;
ConVar g_cvTimer;

public 
Plugin myinfo 
{
    
name "VIP Credits",
    
author "Pilo",
    
description "",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
g_cvCredits CreateConVar("sm_timer_credits""50""How much credits VIP players get.");
    
g_cvTimer CreateConVar("sm_timer_time""120.0""Timer time (Float value)");
    
    
CreateTimer(g_cvTimer.FloatValueTimer_Credits_TIMER_REPEAT);
}

public 
Action Timer_Credits(Handle timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
CheckCommandAccess(i"sm_vip"ADMFLAG_RESERVATION|ADMFLAG_CUSTOM1|ADMFLAG_CUSTOM5|ADMFLAG_CUSTOM6))
            {
                
Store_SetClientCredits(iStore_GetClientCredits(i) + g_cvCredits.IntValue);
                
PrintToChat(i"[SM] All \x04VIP\x01 players received \x04%i\x01 credits"g_cvCredits.IntValue);
            }
        }
    }

__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 25$

Last edited by Pilo; 05-07-2020 at 11:35.
Pilo is offline
Bolimha
New Member
Join Date: Dec 2019
Old 05-07-2020 , 18:50   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #3

Hello, thank you for the reply. And for making the plugin, i'm so grated. I'm really thankful.

Last edited by Bolimha; 05-07-2020 at 18:53. Reason: .
Bolimha is offline
tommie
Junior Member
Join Date: Jul 2020
Location: US
Old 10-06-2020 , 19:47   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #4

Quote:
Originally Posted by Pilo View Post
PHP Code:
#include <sourcemod>
#include <store>

ConVar g_cvCredits;
ConVar g_cvTimer;

public 
Plugin myinfo 
{
    
name "VIP Credits",
    
author "Pilo",
    
description "",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
g_cvCredits CreateConVar("sm_timer_credits""50""How much credits VIP players get.");
    
g_cvTimer CreateConVar("sm_timer_time""120.0""Timer time (Float value)");
    
    
CreateTimer(g_cvTimer.FloatValueTimer_Credits_TIMER_REPEAT);
}

public 
Action Timer_Credits(Handle timer)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
CheckCommandAccess(i"sm_vip"ADMFLAG_RESERVATION|ADMFLAG_CUSTOM1|ADMFLAG_CUSTOM5|ADMFLAG_CUSTOM6))
            {
                
Store_SetClientCredits(iStore_GetClientCredits(i) + g_cvCredits.IntValue);
                
PrintToChat(i"[SM] All \x04VIP\x01 players received \x04%i\x01 credits"g_cvCredits.IntValue);
            }
        }
    }

I tried compiling the plugin and I got this error every time and I'm not sure how to fix it


Code:
extra/store.inc(24) : error 050: constant 'szName' already defined

extra/store.inc(55) : error 050: constant 'iId' already defined
tommie is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-06-2020 , 20:56   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #5

Quote:
Originally Posted by tommie View Post
I tried compiling the plugin and I got this error every time and I'm not sure how to fix it


Code:
extra/store.inc(24) : error 050: constant 'szName' already defined

extra/store.inc(55) : error 050: constant 'iId' already defined
Try to compile the plugin with an older version of sourcemod.
__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
tommie
Junior Member
Join Date: Jul 2020
Location: US
Old 10-07-2020 , 10:35   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #6

Quote:
Originally Posted by SSheriFF View Post
Try to compile the plugin with an older version of sourcemod.
Still giving me the same error, unless im just using the same sourcemod and not realizing it. could someone possibly compile it for me and post it here
tommie is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-07-2020 , 11:20   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #7

Quote:
Originally Posted by tommie View Post
Still giving me the same error, unless im just using the same sourcemod and not realizing it. could someone possibly compile it for me and post it here
Attached Files
File Type: smx VipCredits.smx (4.2 KB, 33 views)
__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
tommie
Junior Member
Join Date: Jul 2020
Location: US
Old 10-07-2020 , 12:16   Re: [REQ] Free Credits To Vip In Zeph Store
Reply With Quote #8

Thank you for the help!
tommie 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 11:02.


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