stats code - 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: stats code (
/showthread.php?tid=551306)
stats code -
Rog - 18.12.2014
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+
Re: stats code -
Sawalha - 18.12.2014
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;
}
Re: stats code -
Rog - 18.12.2014
ty i will try to use this