From a6b4f06fd76f1030653d05a07d481e0dd00bb3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Budziak?= Date: Wed, 16 Jun 2021 22:23:48 +0200 Subject: [PATCH] Credits --- scripting/shopsms_service_credits.sp | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 scripting/shopsms_service_credits.sp diff --git a/scripting/shopsms_service_credits.sp b/scripting/shopsms_service_credits.sp new file mode 100644 index 0000000..2f56699 --- /dev/null +++ b/scripting/shopsms_service_credits.sp @@ -0,0 +1,38 @@ +#pragma semicolon 1 +#pragma newdecls required +#include +#include + +#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); +}