When player shot player
#10

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new Float:X,Float:Y,Float:Z,Float:pX,Float:pY,Float:pZ;
    GetPlayerPos(playerid, pX,pY,pZ);
    if((newkeys & KEY_FIRE))
    {
    	for(new i=0; i < MAX_PLAYERS; i++)
		{
  			if(IsPlayerInRangeOfPoint(i,60, pX,pY,pZ))
   			{
      			if(i != playerid)
	        	{
					GetPlayerPos(i, X,Y,Z);
  					if(IsPlayerAimingAt(playerid, X,Y,Z,1))
    				{
    				SetPlayerWantedLevel(playerid, GetPlayerWantedLevel( playerid )+1 );
					}
				}
			}
		}
	}
	return 1;
}
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ,  Float:ObjX, Float:ObjY, Float:ObjZ,  Float:FrX, Float:FrY, Float:FrZ)
{

	new Float:TGTDistance;

	// get distance from camera to target
	TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));

	new Float:tmpX, Float:tmpY, Float:tmpZ;

	tmpX = FrX * TGTDistance + CamX;
	tmpY = FrY * TGTDistance + CamY;
	tmpZ = FrZ * TGTDistance + CamZ;

	return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
    new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
    GetPlayerCameraPos(playerid, cx, cy, cz);
    GetPlayerCameraFrontVector(playerid, fx, fy, fz);
    return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}
Reply


Messages In This Thread
When player shot player - by kiwi123 - 12.08.2010, 10:50
Re: When player shot player - by Mike_Peterson - 12.08.2010, 12:40
Re: When player shot player - by JonyAvati - 12.08.2010, 12:49
Re: When player shot player - by Mike_Peterson - 12.08.2010, 13:03
Re: When player shot player - by Hiddos - 12.08.2010, 13:13
Re: When player shot player - by Mike_Peterson - 12.08.2010, 13:17
Re: When player shot player - by kiwi123 - 12.08.2010, 13:39
Re: When player shot player - by 0ne - 12.08.2010, 14:02
Re: When player shot player - by akis_tze - 12.08.2010, 14:34
Re: When player shot player - by akis_tze - 12.08.2010, 15:46

Forum Jump:


Users browsing this thread: 1 Guest(s)