SA-MP Forums Archive
Get/Set Score - 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: Get/Set Score (/showthread.php?tid=379808)



Get/Set Score - kbalor - 23.09.2012

I am using this Duel System https://sampforum.blast.hk/showthread.php?tid=254032

How do I get the score everytime I win in every single duel?



For example: Playeryou vs Playerme then I won in 1 duel then my Duel score should be 1.

I know I should add Duel in

pawn Код:
enum PlayerData
{
    AdminLevel,
    Kills,
    Reps,
    Deaths,
    Hours,
    Minutes,
    Seconds,
    TotalTime,
        Duel, <---------
    ConnectTime



Re: Get/Set Score - YourLord - 23.09.2012

use this setplayerscore + getplayerscore for the winner.


Re: Get/Set Score - Lordzy - 23.09.2012

You could create a variable when player enters the duel and when he dies, give score to the killer.
Example:
pawn Код:
new InDuel[MAX_PLAYERS];
CMD:duel(playerid,params[])
{
   InDuel[playerid]=1;
   return 1;
}

public OnPlayerDeath(playerid,killerid,reason)
{
   if(InDuel[killerid] == 1) //Checking whether the killer is in duel.
   {
      SetPlayerScore(killerid)(GetPlayerScore(killerid)+1; //Gives +1 score.
   }
   if(InDuel[playerid] == 0)
   {
     SendClientMessage(playerid, 0xFF0000, "You Lost!");
   }
   return 1;
}



Re: Get/Set Score - kbalor - 23.09.2012

Quote:
Originally Posted by [xB]Lordz
Посмотреть сообщение
You could create a variable when player enters the duel and when he dies, give score to the killer.
Example:
pawn Код:
new InDuel[MAX_PLAYERS];
CMD:duel(playerid,params[])
{
   InDuel[playerid]=1;
   return 1;
}

public OnPlayerDeath(playerid,killerid,reason)
{
   if(InDuel[killerid] == 1) //Checking whether the killer is in duel.
   {
      SetPlayerScore(killerid)(GetPlayerScore(killerid)+1; //Gives +1 score.
   }
   if(InDuel[playerid] == 0)
   {
     SendClientMessage(playerid, 0xFF0000, "You Lost!");
   }
   return 1;
}
MEGA EDIT: Just a simple question. Is it correct that this
pawn Код:
PlayerInfo[killerid][Duels]++;
will add + 1 to my duel scoring?