AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [ClientPrefs] Functions (https://forums.alliedmods.net/showthread.php?t=309777)

eyal282 08-06-2018 19:04

[ClientPrefs] Functions
 
1 Attachment(s)
This snippet is expected to grow depending on the functions clientprefs is currently missing relative to sqlite's full potential

This snippet has two natives and one forward.

Natives:

Code:

native clientprefsFunc_GetAuthIdCookie(const String:Name[100], const String:AuthId[100], String:buffer[], length, &timestamp);

// Allows you to get the value of a Client preference cookie based on an authID string.

// const String:Name[100] - Name of client preference cookie.
// const String:AuthId[100] - String Auth/STEAM ID of player to get.
// String:buffer[] - Value of cookie of the Auth Id. or equal to "clientprefsFuncError_CookieNotFound" if the cookie was not found, or equal to "clientprefsFuncError_AuthIdNotFound" if the Auth Id does not exist within the cookie.
// length - Length of the buffer.
// &timestamp - Copyback of the timestamp at which the cookie was last updated.

native clientprefsFunc_SortCookie(const String:Name[100], bool:Ascending = false, String:Error[50], Handle:AuthIdArray, Handle:ValueArray, Handle:TimestampArray);

// Allows you to sort a cookie and have its sorted results in the three arrays.

// const String:Name[100] - Name of client preference cookie.
// bool:Ascending - true if to sort in an ascending order, false if to sort in a descending order.
// String:Error[50] - Will be empty if sorting was successful, equal to "clientprefsFuncError_CookieNotFound" if the cookie was not found, equal to "clientprefsFuncError_CookieEmpty" if nothing was found to sort.
// Handle:AuthIdArray - Handle to a dynamic array which YOU created that will contain all Auth Ids found in the cookie. Block size should be equal to 100.
// Handle:ValueArray - Handle to a dynamic array which YOU created that will contain all values found in the cookie. Block size should be equal to 100.
// Handle:TimestampArray - Handle to a dynamic array which YOU created that will contain all timestamps found in the cookie. Block size should be equal to 1.

// Note: Within the same index in the arrays you will get the data of the same Auth Id.
// Note: If you don't want to flow with errors, create the arrays even if you don't use them.
// Note: After finishing with the arrays you should clear / destroy them.

The forward:

Code:

// public clientprefsFunc_OnConnected()

// Called when successfully connected to the database.

// Note: The entire plugin is useless before this is called.
// Note: This forward may be called before your plugin's OnPluginStart

You should consider creating a preference cookie that always contains the client's name if you wish to create a ranking system.

IMPORTANT NOTE! This snippet assumes you used the default values for databases.cfg for clientprefs ( I doubt you had any reason to change it )


All times are GMT -4. The time now is 23:35.

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