Raised This Month: $32 Target: $400
 8% 

[COOKIES] Value always 0 !


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 03-14-2014 , 18:03   Re: [COOKIES] Value always 0 !
Reply With Quote #11

Sorry if code is totally messy, updated the main post.
I don't think the problem is from the declaration of cookies because it's should return me a invalid handle to cookie when I try to read/write into, am I right ?

And well, yes, it does, the contain is always != 0.

PHP Code:
    "1" //test item
    
{
        
"item_name"      "Health Potion"
        "attribut_name"  "health regen"
        "value"           "5"
        "cost"           "25"
        "time"              "10"
        "override"         "0"    
        "class"          "ALL"
    

__________________
Want to check my plugins ?

Last edited by Arkarr; 03-14-2014 at 18:06.
Arkarr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-14-2014 , 20:29   Re: [COOKIES] Value always 0 !
Reply With Quote #12

I'd say the problem lies maybe in either the .cfg or a side code.

I'd try to print to server every single value you can think of during the save & load of and try to debug with that. And maybe before try to simply reload the cookie directly after having saved it (and try to load an arbitrary cookie that you know has a good value; probably getting the wrong string somehow).
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 03-15-2014 , 03:55   Re: [COOKIES] Value always 0 !
Reply With Quote #13

Yup, already done this :

PHP Code:
!sm_rpgtest

public Action:TestCookie(clientargs)
{
    
SetClientCookie(clientCookie_Upgrade_lvl[3], "4");
    
PrintToChat(client"cookie, set!");
    
RestoreUpgrade(client);
    
PrintToChat(client"restored !");
    return 
Plugin_Handled;

And if I open my menu, the cookie Cookie_Upgrade_lvl[3] is correctly set to 4 and effect are correctly apply!

STILL NOT WORKING D;
__________________
Want to check my plugins ?

Last edited by Arkarr; 04-05-2014 at 16:04.
Arkarr is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 02-11-2020 , 08:17   Re: [COOKIES] Value always 0 !
Reply With Quote #14

Alright so I may have solved your issue as I ran into this issue too. The cookies registered can't have the same base name and a unique descriptor argument. Despite what information i've read online about the purpose of the descriptor to be created to uniquely identify a cookie further to prevent clashes with other plugins using basic cookie names that may be re-used in other plugins.

Defining like this will cause the issues.

PHP Code:
g_hTerroristSkin RegClientCookie("PlayerSkins_P""Players Custom Skin Selection (Terrorist)"CookieAccess_Public);
g_hCounterTerroristSkin RegClientCookie("PlayerSkins_P""Players Custom Skin Selection (Counter-Terrorist)"CookieAccess_Public); 
After defining them this way all the issues went away.

PHP Code:
g_hTerroristSkin RegClientCookie("PlayerSkins_P_1""Players Custom Skin Selection (Terrorist)"CookieAccess_Public);
g_hCounterTerroristSkin RegClientCookie("PlayerSkins_P_2""Players Custom Skin Selection (Counter-Terrorist)"CookieAccess_Public); 
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards 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 21:41.


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