18.12.2014, 07:32
Up, in your script:
Under OnPlayerConnect
Now, OnPlayerWeaponShot part.
pawn Код:
new BShoot[MAX_PLAYERS], BHit[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
BShoot[playerid] = 0;
BHit[playerid] = 0;
//Resetting the variables.
return 1;
}
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;
}