GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
Theepiccoder - 03.07.2016
Hello all.
Before you post, learn INI and other, it is NOT about Saving/Loading.
(pNovac means pMoney)
I'm having a problem.
When the player completes a job (like going through checkpoints) it is supposed to give him $100:
Код:
PlayerInfo[playerid][pNovac] = GetPlayerMoney(playerid) + 100;
GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
Instead, it does this:
pNovac * 2 + 100
Could somebody help (if you understand)?
Also, when the player reconnects, it gives him the money like it's supposed to ($1100 instead of $2100)
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
oktokt1 - 03.07.2016
That becoz u Gave money 2 times by 2 ways.
He have no money then u used first line to set PlayerInfo[playerid][pNovac] to 100$ then again GivePlayerMoney PlayerInfo[playerid][pNovac]
Make it just
Код:
new money;
GetPlayerMoney(playerid, money);
ResetPlayerMoney(playerid);
SetPlayerMoney(playerid, money+ 100); //replce 100 to how much money will u give
return 1;
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
Theepiccoder - 03.07.2016
This function doesn't exist.
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
oktokt1 - 03.07.2016
Sorry its my mistake
Код:
new money;
GetPlayerMoney(playerid, money);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, money+ 100); //replce 100 to how much money will u give
return 1;
Lmfao u can just make it
Код:
GivePlayerMoney (playerid, 100); //replce 100 to how much money will u give
If u want to make msg for that then use the 1st code
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
Theepiccoder - 03.07.2016
Oh, lmfao i'm dumb, thank you.
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
oktokt1 - 03.07.2016
Quote:
Originally Posted by Theepiccoder
Oh, lmfao i'm dumb, thank you.
|
You are welcome.
Re: GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem -
Stinged - 03.07.2016
To update pNovac, do this:
Код:
PlayerInfo[playerid][pNovac] += money;
+= -> Increase by
-= -> Decrease by
*= -> Multiply by
/= -> Divide by