Making a pScore add 2 (not 1) - 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)
+--- Thread: Making a pScore add 2 (not 1) (
/showthread.php?tid=338745)
Making a pScore add 2 (not 1) -
stormchaser206 - 30.04.2012
How would you make a pScore add 2 score instead of 1. So i know ++ would make 1 score, but how would you make 2 score? Please reply.
Re: Making a pScore add 2 (not 1) -
Luis- - 30.04.2012
This is what i'd do.
Re: Making a pScore add 2 (not 1) -
antonio112 - 30.04.2012
score = score + 2;
score = score - 4;
score = score * 2;
Is this what you're asking for ?
Re: Making a pScore add 2 (not 1) -
stormchaser206 - 30.04.2012
This would work in an array right? Cause i am using this array:
pawn Код:
enum pInfo
{
pPass,
pCash,
pScore,
pAdmin,
pKills,
pDeaths,
pVip,
pRank,
pMwffaClan
}
Re: Making a pScore add 2 (not 1) -
Luis- - 30.04.2012
Guessing it would be something like this;
pawn Код:
PlayerInfo[playerid][pScore] = PlayerInfo[playerid][pScore] + 2
It wont work in your array, use the above code in your script.
Re: Making a pScore add 2 (not 1) -
Face9000 - 30.04.2012
pawn Код:
pInfo[playerid][pScore]+2;
AW: Making a pScore add 2 (not 1) -
Blunt P - 30.04.2012
PHP код:
enum pInfo{
pkills,
ppoints,
pdeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
later on OnPlayerDeath->
PHP код:
if blablablabla{
PlayerInfo[playerid][pdeaths] ++;
PlayerInfo[killerid][pkills] ++;
Playerinfo[killerid][ppoints] += 2;
Re: Making a pScore add 2 (not 1) -
MP2 - 30.04.2012
Use the += operator:
variable += 2;
Respuesta: Making a pScore add 2 (not 1) -
Marricio - 01.05.2012
misread, edited-
Re: Making a pScore add 2 (not 1) -
admantis - 01.05.2012
I want to add that using the '+=' operator is much easier, but you can also use "-=" to subtract numbers, /= to divide, *= to multiply.
pawn Код:
score += 2; // score will now have +2
score -= 5; // subtract 5 from score
score /= 16; // divide score by 16
score *= 3; // multiply score by 3