Page 1 of 1

Save Coins Nickname

Posted: 24 Apr 2017, 14:22
by mzqx
I want to know if is right like this

Code: Select all

public LoadCoins(id)
{
	new szName[32], iStartValue
	iStartValue = get_pcvar_num(Cvar_Start_Coins)
	
	get_user_name(id, szName, 31);
	
	new szData[16]
	
	if(fvault_get_data(g_szVaultName, szName, szData, sizeof(szData) - 1))
	{
		g_iEscapeCoins[id] = str_to_num(szData)
	}
	else
	{
		g_iEscapeCoins[id] = iStartValue
	}
}

public SaveCoins(id)
{
	new szName[32], iMaxValue;
	iMaxValue = get_pcvar_num(Cvar_Max_Coins)
	
	get_user_name(id, szName, 31);
	
	// Set Him to max if he Higher than Max Value
	if(g_iEscapeCoins[id] > iMaxValue)
	{
		g_iEscapeCoins[id] = iMaxValue
	}
	
	new szData[16]
	num_to_str(g_iEscapeCoins[id], szData, sizeof(szData) - 1)
	
	// Save His Name, Escape Coins
	fvault_set_data(g_szVaultName, szName, szData)
}
If not give me your version.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 15:04
by Night Fury
It's correct.
Better use charsmax instead of writing 31.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 15:15
by mzqx
Jack GamePlay wrote: 7 years ago It's correct.
Better use charsmax instead of writing 31.
Do you want to make your version? and give me code here?

Re: Save Coins Nickname

Posted: 24 Apr 2017, 16:45
by johnnysins2000
mzqx wrote: 7 years ago I want to know if is right like this

Code: Select all

public LoadCoins(id)
{
	new szName[32], iStartValue
	iStartValue = get_pcvar_num(Cvar_Start_Coins)
	
	get_user_name(id, szName, 31);
	
	new szData[16]
	
	if(fvault_get_data(g_szVaultName, szName, szData, sizeof(szData) - 1))
	{
		g_iEscapeCoins[id] = str_to_num(szData)
	}
	else
	{
		g_iEscapeCoins[id] = iStartValue
	}
}

public SaveCoins(id)
{
	new szName[32], iMaxValue;
	iMaxValue = get_pcvar_num(Cvar_Max_Coins)
	
	get_user_name(id, szName, 31);
	
	// Set Him to max if he Higher than Max Value
	if(g_iEscapeCoins[id] > iMaxValue)
	{
		g_iEscapeCoins[id] = iMaxValue
	}
	
	new szData[16]
	num_to_str(g_iEscapeCoins[id], szData, sizeof(szData) - 1)
	
	// Save His Name, Escape Coins
	fvault_set_data(g_szVaultName, szName, szData)
}
If not give me your version.
U are trying to make save coins code?

In my Opinion fvault is also ok but if u use nvault it would be better

and use charsmax which like this [31] u have written [32] those are strings

Re: Save Coins Nickname

Posted: 24 Apr 2017, 16:54
by Raheem
johnnysins2000, We use fVault bro as it's easy to edit it's just a .txt file so if you need to delete or edit any player account it will be so easy. Also it's same as nVault so we use fVault better.

mzqx, Jack mean to do like:
    1. public LoadCoins(id)
    2. {
    3.     new szName[32], iStartValue
    4.     iStartValue = get_pcvar_num(Cvar_Start_Coins)
    5.    
    6.     get_user_name(id, szName, charsmax(szName));
    7.    
    8.     new szData[16]
    9.    
    10.     if(fvault_get_data(g_szVaultName, szName, szData, sizeof(szData) - 1))
    11.     {
    12.         g_iEscapeCoins[id] = str_to_num(szData)
    13.     }
    14.     else
    15.     {
    16.         g_iEscapeCoins[id] = iStartValue
    17.     }
    18. }
    19.  
    20. public SaveCoins(id)
    21. {
    22.     new szName[32], iMaxValue;
    23.     iMaxValue = get_pcvar_num(Cvar_Max_Coins)
    24.    
    25.     get_user_name(id, szName, charsmax(szName));
    26.    
    27.     // Set Him to max if he Higher than Max Value
    28.     if(g_iEscapeCoins[id] > iMaxValue)
    29.     {
    30.         g_iEscapeCoins[id] = iMaxValue
    31.     }
    32.    
    33.     new szData[16]
    34.     num_to_str(g_iEscapeCoins[id], szData, sizeof(szData) - 1)
    35.    
    36.     // Save His Name, Escape Coins
    37.     fvault_set_data(g_szVaultName, szName, szData)
    38. }

Re: Save Coins Nickname

Posted: 24 Apr 2017, 17:31
by mzqx
Ok. Thanks
Solved.
EDIT: error 012 invalid function call, not a valid address... without charmax is working.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 17:55
by Raheem
Code updates, See it.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 18:13
by mzqx
Holly.. how i miss that
Thanks.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 18:36
by Raheem
It's not advised to use names in saving the Escape Coins because anyone can enter with your name and steal all your Coins. Also for all should make auto generation for steamid in Dproto or ReUnion so no one can use steam changer to steal another player.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 20:48
by mzqx
Raheem wrote: 7 years ago It's not advised to use names in saving the Escape Coins because anyone can enter with your name and steal all your Coins. Also for all should make auto generation for steamid in Dproto or ReUnion so no one can use steam changer to steal another player.
I know... i will add /reg system.. who is smart will reg who is idiot will not.
on STEAMID i don't get their name and if a one player lose Coins from so much players data Coins will be lose
And player come at me and tell me he lost 10000 coins and where to know his nickname from steamid...?

Re: Save Coins Nickname

Posted: 24 Apr 2017, 21:28
by Raheem
You don't need to know his name, Just he will give you his name and then you will search for it and then back to him his coins. Or you mean if he re-installed his game in case he is no-steam so he won't be able to remember his old steamid. Ok anyway you can do it as you need. And in next release i'll make cvar so one can use names, steamids, ips.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 21:34
by mzqx
Raheem wrote: 7 years ago You don't need to know his name, Just he will give you his name and then you will search for it and then back to him his coins. Or you mean if he re-installed his game in case he is no-steam so he won't be able to remember his old steamid. Ok anyway you can do it as you need. And in next release i'll make cvar so one can use names, steamids, ips.
Yes he won't be able to remember his old steam id if he reinstall the game.

Re: Save Coins Nickname

Posted: 24 Apr 2017, 21:58
by Raheem
Ok, That's good reason. So use register system as you said. It will be nice idea.

Re: Save Coins Nickname

Posted: 20 May 2017, 06:13
by Night Fury
Raheem! Feel Freedom without studying..It's good feeling if you're studying & other people like me playing. :P :P

Re: Save Coins Nickname

Posted: 20 May 2017, 19:52
by Raheem
Jack GamePlay wrote: 7 years ago Raheem! Feel Freedom without studying..It's good feeling if you're studying & other people like me playing. :P :P
You are noob and study things you don't like but i'am studying things i like so for me studying is same as playing...... 8-)
Also what is the relation between your comment and this topic :?: :?: