GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]); Problem
#1

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)
Reply
#2

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;
Reply
#3

Код:
SetPlayerMoney
This function doesn't exist.
Reply
#4

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
Reply
#5

Oh, lmfao i'm dumb, thank you.
Reply
#6

Quote:
Originally Posted by Theepiccoder
Посмотреть сообщение
Oh, lmfao i'm dumb, thank you.
You are welcome.
Reply
#7

To update pNovac, do this:
Код:
PlayerInfo[playerid][pNovac] += money;
+= -> Increase by
-= -> Decrease by
*= -> Multiply by
/= -> Divide by
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)