PHP Code:
public Native_ForceSaveClientData(Handle:plugin, numParams)
{
/* Save all the data like in OnClientDisconnect, just in case? */
Store_SaveClientData(GetNativeCell(1));
Store_SaveClientInventory(GetNativeCell(1));
Store_SaveClientEquipment(GetNativeCell(1));
return 1;
}
public Native_ReloadClientInventory(Handle:plugin, numParams)
{
/* (Re-)load inventory stuff... */
Store_LoadClientInventory(GetNativeCell(1));
return 1;
}
^ Simply made with the "coding style" of natives, et cetera, from the current store from
github.com/dvarnai/store-plugin .
Add:
PHP Code:
CreateNative("Store_ForceSaveClientData", Native_ForceSaveClientData);
CreateNative("Store_ReloadClientInventory", Native_ReloadClientInventory);
within the procedure called:
PHP Code:
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
Add:
PHP Code:
native Store_ForceSaveClientData(client);
native Store_ReloadClientInventory(client);
to
addons/sourcemod/scripting/include/store.inc.
1. Make the adjustments (in store.sp & include/store.inc).
2. Re-compile Store
To use( in your plugin):
Quote:
Originally Posted by GetRektByNoob
The problem is that I can't include the store.sp file to my file [...]
|
You have to to stuff like e.g.
PHP Code:
#include <store>
in your plugin, to be able to use the natives from Store.
Then do things in this order:
1. Run Store_ForceSaveClientData(client), to save the client's current credits/inventory, just in case.
2. Modify your stuff in the database, the way you currently do.
3. Run Store_ReloadClientInventory(client)
Store_ForceSaveClientData is done due to the way Store works with in-plugin caching of credits, and in order to prevent the client form losing too many credits or so during your feature.
You could potentially just do Store_ReloadClientInventory, but the user would then lose all credits and so that has happened since last time Store saved the user's data, therefore,
please be sane, and do it in the above order.
PROVIDED WITH ABSOLUTELY NO GUARANTEE OR SUPPORT.
__________________