stats code
#2

Up, in your script:
pawn Код:
new BShoot[MAX_PLAYERS], BHit[MAX_PLAYERS];
Under OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
    BShoot[playerid] = 0;
    BHit[playerid] = 0;
    //Resetting the variables.
    return 1;
}
Now, OnPlayerWeaponShot part.
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    switch(weaponid)
    {
          case 22..38: // These are the weapons which launches bullets only. not like fist, etc..
          {
               BShoot[playerid]+=1; // Increasing the value of player's shoots variable.
               if(hittype == BULLET_HIT_TYPE_PLAYER) // if the hitted was a player
               {
                      if(IsPlayerConnected(hitid)) // Checking if hitid is a valid player or not.
                      {
                            BHit[hitid]+=1; // Increasing the value of hits which hitid received.
                      }
               }
          }
      }
      return 1;
}
Reply


Messages In This Thread
stats code - by Rog - 18.12.2014, 05:54
Re: stats code - by Sawalha - 18.12.2014, 07:32
Re: stats code - by Rog - 18.12.2014, 07:57

Forum Jump:


Users browsing this thread: 1 Guest(s)