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

[COOKIES] Value always 0 !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 03-09-2014 , 07:54   [COOKIES] Value always 0 !
Reply With Quote #1

I'm trying to get value from cookies but it always return 0 !
All my other cookies work, except the one who are inside Cookie_Upgrade[] and Cookie_Upgrade_lvl[]

here is my stock :
Spoiler


This code will be executed 1.0 sec after player spawn. It's too late to grab cookies ?

Code executed when OnClientDisconnect() to save cookies.

Spoiler


My stock to create cookies (lauch when OnPluginStart() )
Spoiler



PS: I already read this nice tutorial about client prefs but it doesn't help me (at least, in my case.)
__________________
Want to check my plugins ?

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

You should usually use OnClientCookiesCached; thought I'd say that probably 99,9% of the time, 1 sec after a player respawn his cookies are cached.

How and where are you saving client's cookies ? You didn't eat them, did you ?
__________________
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-10-2014 , 07:21   Re: [COOKIES] Value always 0 !
Reply With Quote #3

Quote:
Originally Posted by RedSword View Post
You should usually use OnClientCookiesCached; thought I'd say that probably 99,9% of the time, 1 sec after a player respawn his cookies are cached.

How and where are you saving client's cookies ? You didn't eat them, did you ?
Well, not at home right now, gonna post my code when I could. I have already try to lauch this stock OnClientCookieCached()

I don't save them... ( SetClientCookie() when OnClientDisconnect() ? Is that what you mean by save ?) I prefer to eat them all !

EDIT: updated OP, code get modified. Still doesn't work...
__________________
Want to check my plugins ?

Last edited by Arkarr; 03-10-2014 at 13:22.
Arkarr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-10-2014 , 19:18   Re: [COOKIES] Value always 0 !
Reply With Quote #4

Quote:
Originally Posted by Arkarr View Post

I don't save them... ( SetClientCookie() when OnClientDisconnect() ? Is that what you mean by save ?)
That's one way, yes.

Btw, most plugins cache them thought (rather than querying when you need it). You just dump the cache value in the cookie OnDisconnect, and you load the cookie value OnCookiePrecached. iirc

Red
__________________
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-11-2014 , 07:32   Re: [COOKIES] Value always 0 !
Reply With Quote #5

So, I should create a timer and save cookies every 30 sec ? Anyway, this code still doesn't work !
__________________
Want to check my plugins ?
Arkarr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-11-2014 , 18:50   Re: [COOKIES] Value always 0 !
Reply With Quote #6

Quote:
Originally Posted by Arkarr View Post
So, I should create a timer and save cookies every 30 sec ? Anyway, this code still doesn't work !
wtf ?

You have a bunch of examples you can learn from...

http://www.sourcemod.net/plugins.php...tion=&search=1

I suggest deathbeam.
__________________
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-12-2014 , 14:19   Re: [COOKIES] Value always 0 !
Reply With Quote #7

Quote:
Originally Posted by RedSword View Post
wtf ?
Yup, exactly. All my other cookies are working (on same plugin) but this one ? Na, plugin just won't load them, I have already triple-check if cookie correctly saved, and they are.
__________________
Want to check my plugins ?
Arkarr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-13-2014 , 21:36   Re: [COOKIES] Value always 0 !
Reply With Quote #8

Please post the code where you save your cookie...............
__________________
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-14-2014 , 08:17   Re: [COOKIES] Value always 0 !
Reply With Quote #9

Updated the main post, I have posted my stock wich is fired OnClientDisconnect().
__________________
Want to check my plugins ?
Arkarr is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-14-2014 , 17:34   Re: [COOKIES] Value always 0 !
Reply With Quote #10

How is Cookie_Upgrade_lvl[] declared ?

And does addons/sourcemod/configs/TF2_RPG.cfg contains the wanted value ? ( != 0 )
__________________
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

Last edited by RedSword; 03-14-2014 at 17:36.
RedSword is offline
Reply



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:08.


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