Adding problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding problem (
/showthread.php?tid=271814)
Adding problem -
slymatt - 26.07.2011
When i add two things together it goes wrong:
Код:
PlayerInfo[playerid][bankdeposit] += strval(inputtext)
ok so lets say PlayerInfo[playerid][bankdeposit] holds the value of 1
and Strval(inputtext) holds the value of 4
when i do the doe i have done it always equals inputtext which is 4 what am i doing wrong
Re: Adding problem -
=WoR=Varth - 26.07.2011
I don't get what you mean.
pawn Код:
new asd = 4,
qwe = 2;
qwe += asd
Result:
qwe == 6
asd == 4
Re: Adding problem -
slymatt - 26.07.2011
what i mean is i want to add both the numbers together but when i use the += it just gives me the output of the second value and over rights the first one.
Re: Adding problem -
linuxthefish - 26.07.2011
Try making a new value that equals the other 2 added together, this might not work cos i'm tired
pawn Код:
new money[playerid] = PlayerInfo[playerid][bankdeposit] + strval(inputtext);
PlayerInfo[playerid][bankdeposit] = money[playerid];
Re: Adding problem -
=WoR=Varth - 26.07.2011
Just like my first post
pawn Код:
new asd = 4,
qwe = 2;
qwe += asd
Result:
qwe == 6
asd == 4
That's how it's work.
Re: Adding problem -
slymatt - 26.07.2011
Just like your first post it didnt work.
Re: Adding problem -
Mean - 26.07.2011
Try this:
pawn Код:
PlayerInfo[ playerid ][ bankdeposit ] = PlayerInfo[ playerid ][ bankdeposit ] + strval( inputtext );
Could be, I'm just guessing, as I am not 100% sure, give it a try.
Re: Adding problem -
slymatt - 26.07.2011
Nope that didnt work either PlayerInfo[playerid][Bankdeposit] Always equals the inputtext =l
Re: Adding problem -
slymatt - 26.07.2011
i have done this
Код:
printf("PlayerInput: ",strval(inputtext));
printf("PlayerInput: ", PlayerInfo[playerid][Bankdeposit]);
But when i have deposited both of the printf's show playerinput: and no values after them... =( this is getting so frustrating
Re: Adding problem -
slymatt - 26.07.2011
ye it was my fault i forgot to open an
if(INI_Open(getINI(playerid)))
so PlayerInfo never had a value
and your method showed me that so im very thankfull