Raised This Month: $ Target: $400
 0% 

[SOLVED] Saving upgrades with nVault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-26-2015 , 06:47   Re: Saving upgrades with nVault
Reply With Quote #1

Everything works fine, but the upgrades are saved only after disconnect/retry. You forgot to add the load/save functions on connect/disconnect, so I'm not sure if I added them the right way:

PHP Code:
public client_connect(id)
{
    
LoadData(id)
    
get_user_authid(id g_szAuthID[id] , charsmax(g_szAuthID[]))
}

public 
client_disconnect(id)
    
SaveData(id
PS: Am I using these correctly:

1. Add all upgrades to the menu:

PHP Code:
for(new 0sizeof(g_Upgrades); i++)
    {
        
iPrice g_Upgrades[UpgradeTypes:i][iValue]
        
formatex(szKeycharsmax(szKey), "%i"i)
        
formatex(szItemcharsmax(szItem), "%s%s \r[\y%i Alien Cells\r]"PlayerHasUpgrade(id UpgradeTypes:i) ? "\y" furien_get_aliencells(id) >= iPrice "\w" "\d"g_Upgrades[UpgradeTypes:i][szDescription], iPrice)        
        
menu_additem(upgrademenuszItemszKey0)
    } 
2. The message:

PHP Code:
formatex(szMsgcharsmax(szMsg), "%s %s"g_szPrefixg_Upgrades[UpgradeTypes:iKey][szMessage]) 
I will also need a native to check whether a player has an upgrade, so I made this, but it doesn't work:

PHP Code:
public _furien_get_upgrade(idiUpgrade)
    return 
PlayerHasUpgrade(id UpgradeTypes:iUpgrade
//Edit: I figured out the native part.

Last edited by OciXCrom; 10-26-2015 at 08:16.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-26-2015 , 08:18   Re: Saving upgrades with nVault
Reply With Quote #2

For the 5th time, learn to use natives. I already told you in the other thread that style 0 does not pass the params in the header. You have to use get_param/get_string to retrieve them.
__________________

Last edited by HamletEagle; 10-26-2015 at 12:29.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-26-2015 , 15:51   Re: Saving upgrades with nVault
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
For the 5th time, learn to use natives. I already told you in the other thread that style 0 does not pass the params in the header. You have to use get_param/get_string to retrieve them.
I'm using style 1 in this plugin and it's working without any problems.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-26-2015 , 16:52   Re: Saving upgrades with nVault
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
I'm using style 1 in this plugin and it's working without any problems.
Don't use style 1, it is deprecated.
__________________
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-26-2015 , 16:48   Re: Saving upgrades with nVault
Reply With Quote #5

Edited above code to load\save on connect/disconnect.

You are on the right track with menu and messaging. You reference the upgrade info by specifying the index and what piece of info you want.

Code:
utIncAlienSpeed = 0
utAddAlienHealth = 1
utAddPredHealth = 2
utDecrScreamCooldown = 3
utUnlockUltraClasses = 4
To access info from IncreaseAlienSpeed you would do:
Code:
g_Upgrades[ UpgradeTypes:0 OR utIncAlienSpeed ][ szDescription ] //String
g_Upgrades[ UpgradeTypes:0 OR utIncAlienSpeed ][ iValue ] //Integer
g_Upgrades[ UpgradeTypes:0 OR utIncAlienSpeed ][ szMessage ] //String
__________________

Last edited by Bugsy; 10-26-2015 at 16:49.
Bugsy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-27-2015 , 06:33   Re: Saving upgrades with nVault
Reply With Quote #6

Oops, I added loading the data before getting the SteamID. It's working now. Thank you very much!
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 22:14.


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