Raised This Month: $235 Target: $400
 58% 

[Tutorial] ClientPrefs


Post New Thread Reply   
 
Thread Tools Display Modes
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 08-01-2016 , 17:28   Re: [Tutorial] ClientPrefs
Reply With Quote #31

It should be documented somewhere that the maximum length of a cookie is 100 characters. I'd like to see it in the API documentation, but here would be good also.
__________________
ddhoward is offline
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, Italy
Old 10-07-2017 , 12:27   Re: [Tutorial] ClientPrefs
Reply With Quote #32

Sorry, but

is this part optional?

Code:
g_bClientPreference[client] = (sValue[0] != '\0' && StringToInt(sValue));
or I need it to make the cookies work properly?
__________________

Last edited by Papero; 10-07-2017 at 12:28.
Papero is offline
Send a message via Skype™ to Papero
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 10-07-2017 , 13:24   Re: [Tutorial] ClientPrefs
Reply With Quote #33

Quote:
Originally Posted by Papero View Post
Sorry, but

is this part optional?

Code:
g_bClientPreference[client] = (sValue[0] != '\0' && StringToInt(sValue));
or I need it to make the cookies work properly?
All that does is make sure the string isn't empty
Addicted. is offline
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, Italy
Old 10-07-2017 , 13:35   Re: [Tutorial] ClientPrefs
Reply With Quote #34

Quote:
Originally Posted by Addicted. View Post
All that does is make sure the string isn't empty
Yeah, but if the string is empty StringToInt will return anyway 0/false
Doc:
Quote:
Integer conversion of string, or 0 on failure
__________________

Last edited by Papero; 10-07-2017 at 13:37.
Papero is offline
Send a message via Skype™ to Papero
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 10-07-2017 , 13:36   Re: [Tutorial] ClientPrefs
Reply With Quote #35

Quote:
Originally Posted by Papero View Post
Yeah, but if the string is empty StringToInt will return anyway 0/false(From doc: Integer conversion of string, or 0 on failure.)
So there is your answer
Addicted. is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-10-2018 , 04:19   Re: [Tutorial] ClientPrefs
Reply With Quote #36

Why do you use Private cookies when it clearly looks like you're trying to make the cookie available for all? Why not Public cookie?
__________________
Accepting private work.

myGaming unique coded versus no VIP no premium.
eyal282 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 07-10-2018 , 05:29   Re: [Tutorial] ClientPrefs
Reply With Quote #37

Quote:
Originally Posted by eyal282 View Post
Why do you use Private cookies when it clearly looks like you're trying to make the cookie available for all? Why not Public cookie?
https://sm.alliedmods.net/new-api/cl...s/CookieAccess

This selection configures whether the user can change the cookie value manually, or whether they can even see the current value via sm_cookies.

CookieAccess_Public means that the user can insert any string into the cookie by using sm_cookies.

CookieAccess_Restricted means that the user can use sm_cookies to view the raw value of the cookie as stored in the database, but cannot change it.

CookieAccess_Private means that the cookie will not show up in the sm_cookies list, and cannot be viewed or changed. The value of the cookie is instead exclusively changed through other means, such as a menu or something.

The vast majority of cookies will be private. There is almost no reason to do anything else. Any cookie that takes a user-defined string would probably be better off having a separate, dedicated command to changing it and reading it. I really can't think of any valid reason to use anything other than CookieAccess_Private.
__________________

Last edited by ddhoward; 07-10-2018 at 06:20.
ddhoward is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-11-2018 , 05:28   Re: [Tutorial] ClientPrefs
Reply With Quote #38

Quote:
Originally Posted by ddhoward View Post
https://sm.alliedmods.net/new-api/cl...s/CookieAccess

This selection configures whether the user can change the cookie value manually, or whether they can even see the current value via sm_cookies.

CookieAccess_Public means that the user can insert any string into the cookie by using sm_cookies.

CookieAccess_Restricted means that the user can use sm_cookies to view the raw value of the cookie as stored in the database, but cannot change it.

CookieAccess_Private means that the cookie will not show up in the sm_cookies list, and cannot be viewed or changed. The value of the cookie is instead exclusively changed through other means, such as a menu or something.

The vast majority of cookies will be private. There is almost no reason to do anything else. Any cookie that takes a user-defined string would probably be better off having a separate, dedicated command to changing it and reading it. I really can't think of any valid reason to use anything other than CookieAccess_Private.
I am using cookies to determine which guns you'll have in a gun menu. If you found the cookie in sm_cookies, you should be able to change one gun with a keybind without returning to menu
__________________
Accepting private work.

myGaming unique coded versus no VIP no premium.
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 00:34.


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