Raised This Month: $ Target: $400
 0% 

Saving what a user decides on a menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 08-09-2008 , 16:29   Saving what a user decides on a menu
Reply With Quote #1

Well I know how to make a menu where it says "New Guns" like CSDM or zombie infection, and I know how to work the whole menus thing.
BUT.. Here's my idea:
A user types /createNAME replacing NAME with anything they want.
Then a menu comes up like the csdm gun menu.
Then, every time they user logs back on they type /NAME which is whatever they put where they did /createNAME and the guns they chose is given.

For example - I type /createMYGUNS.
Gun menu comes up like CSDM and I choose ak47, deagle, all nades.
Then I leave server. Come back tomorrow or something and type /MYGUNS and get ak47,deagle,all nades.

I know how to do menus, and hook say, and all that but where it saves what they named the pack and then actually saving it that gets me.

Is it possible?
PvtSmithFSSF is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-09-2008 , 18:11   Re: Saving what a user decides on a menu
Reply With Quote #2

Yes it's possible.

When you are detecting what they said, you have a string (let's call it said)
Code:
if( equal( said, "/create", 7 ) ){
     //they are trying to create somethign

     //lets get rid of the "/create" part
     copy( said, 127, said[8] );

     //said now contains the part after create
}
Now saving it, I don't know how the guns menus work, but i'll assume you can save the values into a string and load it from a string. So lets say we are trying to save "ak47 deagle all_nades". And we'll pretend that is stored in a string called my_weaps.

Now you can save it in either with vault or nvault (i'll be showing vault because it is slightly easier, but also slower)
Code:
	new vaultSaveKey[40], authid[32];
	get_user_authid(id, authid, 31);
	formatex(vaultSaveKey,39,"MyGuns-%s-%s", authid, said);
	set_vaultdata(vaultSaveKey, my_weaps)
and to load it
Code:
	new his_weaps[150];
	new vaultSaveKey[40], authid[32];
	get_user_authid(id, authid, 31);
	formatex(vaultSaveKey,39,"MyGuns-%s-%s", authid, said);
	get_vaultdata(vaultSaveKey, his_weaps, 150);
his_weaps should be "ak47 deagle all_nades"

Last edited by Emp`; 08-09-2008 at 18:33.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 08-09-2008 , 18:33   Re: Saving what a user decides on a menu
Reply With Quote #3

so much confusing code but I'm working on it
thanks a lot
PvtSmithFSSF is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 08-09-2008 , 18:53   Re: Saving what a user decides on a menu
Reply With Quote #4

And how to give the weapons that are saved?

I mean...if ak47 deagle all_nades is saved, when the user connects, how to give that weapon and not another weapont, isn't more hard?
__________________
IneedHelp 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 05:33.


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