Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credits #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions scripting/shopsms_service_credits.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <shopsms>

#define CREDITS_BY_NATIVE -1

/**
* Gives certain amount of credits to the player
* -
* @param client Client index
* @param amount Amount to give
* @param by_who Optional param to set by who the credits being given from
* -
* @return New amount of credits
*/
native int Shop_GiveClientCredits(int client, int amount, int by_who = CREDITS_BY_NATIVE);

#define SERVICE_ID "credits"

public Plugin myinfo =
{
name = "Shop SMS: Service: Credits",
author = "SeeK",
description = "ShopSMS's extension that allow players to purchase credits.",
version = VERSION,
url = "https://www.sklep-sms.pl/"
};

public void OnPluginStart()
{
ShopRegisterService(SERVICE_ID);
}

public void ShopServicePurchased(int client, int quantity)
{
Shop_GiveClientCredits(client, quantity);
}