Making a pScore add 2 (not 1)
#1

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

pawn Код:
pScore = pScore + 2
This is what i'd do.
Reply
#3

score = score + 2;
score = score - 4;
score = score * 2;

Is this what you're asking for ?
Reply
#4

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

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

pawn Код:
pInfo[playerid][pScore]+2;
Reply
#7

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

Use the += operator:

variable += 2;
Reply
#9

misread, edited-
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)