Adding problem
#1

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

I don't get what you mean.
pawn Код:
new asd = 4,
    qwe = 2;

qwe += asd

Result:
qwe == 6
asd == 4
Reply
#3

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.
Reply
#4

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

Just like my first post
pawn Код:
new asd = 4,
    qwe = 2;

qwe += asd

Result:
qwe == 6
asd == 4
That's how it's work.
Reply
#6

Just like your first post it didnt work.
Reply
#7

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.
Reply
#8

Nope that didnt work either PlayerInfo[playerid][Bankdeposit] Always equals the inputtext =l
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)