Coding Help/Re-API Supported
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#1
Post
by mzqx » 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.
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#2
Post
by Night Fury » 7 years ago
It's correct.
Better use charsmax instead of writing 31.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#3
Post
by mzqx » 7 years ago
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?
-
johnnysins2000
- Veteran Member
- Posts: 678
- Joined: 7 years ago
- Location: Paraguay
-
Contact:
-
Quote
-
0
login to like this post
#4
Post
by johnnysins2000 » 7 years ago
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
Nobody Is That Busy If They Make Time
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#5
Post
by Raheem » 7 years ago
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:
public LoadCoins(id)
{
new szName[32], iStartValue
iStartValue = get_pcvar_num(Cvar_Start_Coins)
get_user_name(id, szName, charsmax(szName));
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, charsmax(szName));
// 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)
}
Last edited by
Raheem 7 years ago, edited 1 time in total.
Reason: charsmax not charmax.......
He who fails to plan is planning to fail
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#6
Post
by mzqx » 7 years ago
Ok. Thanks
Solved.
EDIT: error 012 invalid function call, not a valid address... without charmax is working.
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#7
Post
by Raheem » 7 years ago
Code updates, See it.
He who fails to plan is planning to fail
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#8
Post
by mzqx » 7 years ago
Holly.. how i miss that
Thanks.
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#9
Post
by Raheem » 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.
He who fails to plan is planning to fail
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#10
Post
by mzqx » 7 years ago
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...?
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#11
Post
by Raheem » 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.
He who fails to plan is planning to fail
-
mzqx
- Member
- Posts: 25
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#12
Post
by mzqx » 7 years ago
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.
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#13
Post
by Raheem » 7 years ago
Ok, That's good reason. So use register system as you said. It will be nice idea.
He who fails to plan is planning to fail
-
Night Fury
- Mod Developer
- Posts: 677
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#14
Post
by Night Fury » 7 years ago
Raheem! Feel Freedom without studying..It's good feeling if you're studying & other people like me playing.
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
-
Raheem
- Mod Developer
- Posts: 2214
- Joined: 7 years ago
-
Contact:
-
Quote
-
0
login to like this post
#15
Post
by Raheem » 7 years ago
He who fails to plan is planning to fail
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Register
Sign in
Users browsing this forum: No registered users and 2 guests