17.02.2014, 14:34
Hi, I'm trying to make a weapon stats script that counts a shot on an empty vehicle as a miss, but counts a shot on an occupied vehicle as a hit. The script (below) is counting both empty and occupied vehicle shots as misses and I'm stuck
I appreciate any help thanks
![Angry](images/smilies/evil.gif)
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(!IsPlayerConnected(playerid)) return 0;
shots[playerid] ++;
if(hittype == BULLET_HIT_TYPE_NONE
|| hittype == BULLET_HIT_TYPE_OBJECT
|| hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
{
misses[playerid] ++;
}
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
phits[playerid] ++;
}
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
if(VehicleOccupied(hitid))
{
vhits[playerid] ++;
}
else
{
misses[playerid] ++;
}
}
return 1;
}
stock VehicleOccupied(vehicleid)
{
foreach (new i : Player)
{
if(IsPlayerInVehicle(i,vehicleid)) return 1;
}
return 0;
}
![cool](images/smilies/cool.png)