Raised This Month: $170 Target: $400
 42% 

[ClientPrefs] Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-06-2018 , 19:04   [ClientPrefs] Functions
Reply With Quote #1

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 )
Attached Files
File Type: sp Get Plugin or Get Source (clientprefsFunctions.sp - 17 views - 4.5 KB)
__________________
Accepting private work.

myGaming unique coded versus no VIP no premium.

Last edited by eyal282; 08-08-2018 at 07:20.
eyal282 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:37.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode