SA-MP Forums Archive
[OnplayerDeath]I haVe a Question - 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: [OnplayerDeath]I haVe a Question (/showthread.php?tid=476186)



[OnplayerDeath]I haVe a Question - donhu789 - 17.11.2013

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(PlayerInfo[playerid][Level] >= 1) {
          PlayerInfo[killerid][AdminKills] ++;
     }
     return 1;
}
Insted Of using That Could i Use This ?

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(PlayerInfo[playerid][Level] >= 1) {
          PlayerInfo[killerid][AdminKills] += 1;
     }
     return 1;
}
Guys answer please


Re: [OnplayerDeath]I haVe a Question - prince2 - 17.11.2013

yes u can use it its fine


Re: [OnplayerDeath]I haVe a Question - donhu789 - 17.11.2013

And What Diffrent BEtwin It ?


Re: [OnplayerDeath]I haVe a Question - iJumbo - 17.11.2013

you can also do

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
     if(PlayerInfo[playerid][Level] >= 1) {
          PlayerInfo[killerid][AdminKills] = PlayerInfo[killerid][AdminKills] + 1;
     }
     return 1;
}
but what is the point?

They are the same.. depends on how you want to use it..


Re: [OnplayerDeath]I haVe a Question - donhu789 - 17.11.2013

i just want Each kill THey kill A admin there Admin kills + 1


Re: [OnplayerDeath]I haVe a Question - prince2 - 17.11.2013

Q#1 What is difference between ++ and += operator ?

Answer:-
PlayerInfo[killerid][AdminKills] ++; // ++ is a operator, it can only add one in variable value

// but += is more then just add 1 in variable value

PlayerInfo[killerid][AdminKills] += 1; // += is a operator, it can add what ever in from of it in variable value. In this case it is similar ++ operator

// more example using += operator
PlayerInfo[killerid][AdminKills] += 5; // this will add 5 in variable value
PlayerInfo[killerid][AdminKills] += 7; // this will add 7 in variable value
PlayerInfo[killerid][AdminKills] += 500; // this will add 500 in variable value

// you can't use PlayerInfo[killerid][AdminKills]++ 5 or things like that. ++ operator just can do add 1 in variable value. ++ operator is limited. but += operator is not limited.