stats code
#1

hello i have seen many COD gm but there is nothing about Bullet Shoot: and Bullet Hit:
Bullet Shot = which we wasted and hit
Bullet Hit = which is hit to a player

can anyone help me in giving this code rep+
Reply
#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
#3

ty i will try to use this
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)