Raised This Month: $51 Target: $400
 12% 

Menu Save Player Choice [-HELP-]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 06-05-2016 , 15:46   Menu Save Player Choice [-HELP-]
Reply With Quote #1

Hi guys, how I can save player choice like in CSDM?
Something like this:
1. Get new weapons
2. Previous weapons
3. Previous weapons + don't ask again

I do not really want to leech the CSDM code for this and I was wondering how to do it... I guess the 3rd option will be done with some bools but what about the 2nd one? I guess like in CSDM - with arrays!?

P.S.
It is just a simple menu which is giving weapons with fun module and give ammo with ham module, nothing special or complicated like CSDM's ways.

Last edited by KaLoIaN; 06-05-2016 at 15:59.
KaLoIaN is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-05-2016 , 17:58   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #2

A solution is to download csdm source code, look through code and find part with menu item selection and then figure out how options were saved.Isn't it ?

I think it's an array g_saved[33][3]

g_saved[id][0] - mode "dont show again" 1/0
g_saved[id][1] - primary weapon
g_saved[id][2] - secondary weapon
primary and secondary are saved when choosing them from menu.
siriusmd99 is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 06-06-2016 , 04:50   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #3

Quote:
Originally Posted by siriusmd99 View Post
A solution is to download csdm source code, look through code and find part with menu item selection and then figure out how options were saved.Isn't it ?

I think it's an array g_saved[33][3]

g_saved[id][0] - mode "dont show again" 1/0
g_saved[id][1] - primary weapon
g_saved[id][2] - secondary weapon
primary and secondary are saved when choosing them from menu.
Smart enough, thanks.
I did not want to copy the CSDM code bcoz I am writing better CSDM plugin I know it sounds crazy but I am doing it.
I'll post feedback.
KaLoIaN is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 06-06-2016 , 08:21   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #4

It worked but when I reset it in client_connect & client_disconnect

g_saved[id][0] = 0

It does not reset it lol when I "retry" the server I get the guns.
KaLoIaN is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-06-2016 , 08:42   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #5

Try putting it it client_putinserver. If it doesn't work, post the code.

Last edited by OciXCrom; 06-06-2016 at 08:42.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 06-06-2016 , 09:15   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
Try putting it it client_putinserver. If it doesn't work, post the code.
Nope... didn't worked.
KaLoIaN is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-06-2016 , 09:19   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #7

Show the full code. Don't be afraid nobody would steal your copyright. This forum is open source , private plugins are not supported.
siriusmd99 is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 06-06-2016 , 09:21   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #8

@OciXCrom helped me on skype, my mistake is I forgot to set all to 0
:

g_PlayerChoice[id][1] = 0
g_PlayerChoice[id][2] = 0
g_PlayerChoice[id][3] = 0
KaLoIaN is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-06-2016 , 12:15   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #9

Quote:
Originally Posted by KaLoIaN View Post
@OciXCrom helped me on skype, my mistake is I forgot to set all to 0
:

g_PlayerChoice[id][1] = 0
g_PlayerChoice[id][2] = 0
g_PlayerChoice[id][3] = 0
Nope, it's not mistake.
You have to set only g_PlayerChoice[id][0] = 0, and check before showing gun menu:

if(g_PlayerChoice[id][0])
show_guns_menu(id)
else
give_guns(id)

And why you dont start from 0 ?
you have
PHP Code:
g_PlayerChoice[id][1] , g_PlayerChoice[id][2], g_PlayerChoice[id][3
instead of
PHP Code:
g_PlayerChoice[id][0], g_PlayerChoice[id][1], g_PlayerChoice[id][2
siriusmd99 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-06-2016 , 14:03   Re: Menu Save Player Choice [-HELP-]
Reply With Quote #10

He is not using [0] anywhere, he's starting from [1], but whatever.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 01:50.


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