Move the Economy folder to addons\counterstrikesharp\plugins\
Done
Usage : On its own, the plugin is nothing of the sort. It does not provide any interface for the player and administration, it is created for developers.
API:
Best of all, this plugin is built so that its functionality is modules. A module is a plugin from another developer that uses EconomyAPI to create its own economic relationship between players.
Create CSS plugin
Add EconomyAPI.dll your project.
Use Economy.EconomyAPI
PHP Code:
public override async void Load(bool hotReload) { await EconomyAPI.RegisterModule(this); }
As you notice, this is an asynchronous method, which means that the server will not hang if the kernel is not there, and at the same time will not allow an error to be generated because the API functionality will not work.
Events:
since version 0.2-alpha events have been rewritten to attributes
[EconomyEvent(EventId = EconomyEvents.ItemTransfer] public static void OnItemUsed(Guid itemId, int formerUserId, int newUserId) { }
Attribute parameters In order to have less code in the handler, the basics have been put into parameters, for example product/item Id should be specified in an attribute.
PHP Code:
[EconomyEvent(EventId = EconomyEvents.ProductPurchasing, Id = "83dba2c3-1f3e-4d8e-9bb4-0070358cf68c"] public static EventResult OnProductPurchasing(int userId, Guid productId) // productId = Id { return EventResult.Continue; }
As you have noticed, items support custom attributes, you can specify at which item attributes the handler will work
PHP Code:
[EconomyEvent(EventId = EconomyEvents.ItemUsing, HasAttributes = new string[] { "productId" } ] public static EventResult OnItemUsing(int userId, Guid itemId) { var item = EconomyAPI.GetItemById(Guid.Parse(itemId)) var productId = item.Attributes["productId"]; // The item will always have the attribute, otherwise the handler will not be called. return EventResult.Continue; }
What follows is a seemingly complex example of how MedKit can be implemented via API.