AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [REQ] Free Credits To Vip In Zeph Store (https://forums.alliedmods.net/showthread.php?t=324071)

Bolimha 05-05-2020 16:33

[REQ] Free Credits To Vip In Zeph Store
 
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

Pilo 05-07-2020 11:35

Re: [REQ] Free Credits To Vip In Zeph Store
 
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);
            }
        }
    }



Bolimha 05-07-2020 18:50

Re: [REQ] Free Credits To Vip In Zeph Store
 
Hello, thank you for the reply. And for making the plugin, i'm so grated. I'm really thankful.

tommie 10-06-2020 19:47

Re: [REQ] Free Credits To Vip In Zeph Store
 
Quote:

Originally Posted by Pilo (Post 2698694)
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


SSheriFF 10-06-2020 20:56

Re: [REQ] Free Credits To Vip In Zeph Store
 
Quote:

Originally Posted by tommie (Post 2720483)
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.

tommie 10-07-2020 10:35

Re: [REQ] Free Credits To Vip In Zeph Store
 
Quote:

Originally Posted by SSheriFF (Post 2720490)
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

SSheriFF 10-07-2020 11:20

Re: [REQ] Free Credits To Vip In Zeph Store
 
1 Attachment(s)
Quote:

Originally Posted by tommie (Post 2720550)
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 10-07-2020 12:16

Re: [REQ] Free Credits To Vip In Zeph Store
 
Thank you for the help!


All times are GMT -4. The time now is 05:18.

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