Very strange bug with money -
bobsona - 10.11.2014
Hello,
I have very strange bug.
I'll try to explain it.
If I have
$1 000 000 in my account and I deposit the money in the bank, I will have
$0.
After I die I get the same amount
$1 000 000, but I should have
$-1000.
I think the problem is somewhere in OnPlayerDeath, so I'll give you some code.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
djSetInt("stats.json","players/died",djInt("stats.json","players/died")+1);
pInfo[playerid][Deaths]++;
if(killerid != INVALID_PLAYER_ID && killerid != playerid)
{
pInfo[killerid][Kills]++;
}
GivePlayerMoney(killerid, 5000);
GivePlayerMoney(playerid, -1000);
pInfo[playerid][Money] = GetPlayerMoney(playerid);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 5);
As far as I can see, the money is saved in the variable
pInfo[playerid][Money].
When you respawn, the money is loaded from the same variable and should not be a problem, but it has, as described above.
Any ideas?
P.S. Sorry for my bad English and I hope you can understand my problem.
Respuesta: Very strange bug with money -
aoEXE - 10.11.2014
I think the problem may be that you don't update the value of the variable when the player makes his deposit at the bank
Re: Very strange bug with money -
bobsona - 10.11.2014
No, If I deposit the money in the bank and I exit the server, I'll have
$0 when I enter the server again.
I have tested.
The problem is only with
OnPlayerDeath, but I can't realize why.
Re: Very strange bug with money -
Dziugsas - 10.11.2014
When you deposit your money , do you set player variable to -(that amount that you deposited) ?
Re: Very strange bug with money -
bobsona - 10.11.2014
Yes.
Now I found something very strange.
When I load into account [BG]bobsona(which have $0), the system loads the money from account [BG]BOBSONA, which is totally different account from this.
I'm using pInfo, any ideas how to make the accounts to be case-sensitive?
Re: Very strange bug with money -
meta1 - 10.11.2014
When you format the query you need to insert
After you use "WHERE" and the name variable.
Re: Very strange bug with money -
bobsona - 10.11.2014
I'm not using MySQL.
I save users info in files /scriptfiles/Users/nick.ini
The operating system is Linux, which is case-sensitive.
Re: Very strange bug with money -
meta1 - 10.11.2014
It is weird, however I can redirect you to both ******' post and a register system that uses Y_INI since I am not really good with ini files since I've never used them.
******' post:
Here
System by newbienoob:
Here
Re: Very strange bug with money -
bobsona - 10.11.2014
I posted a question there, but I'm waiting for more suggestions here.
Re: Very strange bug with money -
bobsona - 11.11.2014
Quote:
Originally Posted by bobsona
Yes.
Now I found something very strange.
When I load into account [BG]bobsona(which have $0), the system loads the money from account [BG]BOBSONA, which is totally different account from this.
I'm using pInfo, any ideas how to make the accounts to be case-sensitive?
|
I now think that all problems come from this problem.
You want more code from OnPlayerSpawn?