Hey
Wollte fragen da ich momentan keinen zum Testen habe ob dieser Code denn gehen würde
if(newkeys == KEY_YES && IsACop(playerid) && sStats[playerid][sDuty] != 0)
{
new tid, Float:Distance;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i==INVALID_PLAYER_ID || sStats[i][Eingeloggt] == 0 || IsACop(i), GetPVarInt(i, "Tazed") != 0)continue;
GetPlayerPos(i, ipX[i], ipY[i], ipZ[i]);
if(!IsPlayerAimingAt(playerid, ipX[i], ipY[i], ipZ[i], 1.4))continue;
Distance = GetPlayerDistanceFromPoint(playerid, ipX[i], ipY[i], ipZ[i]);
tid = i;
}
if(Distance > 4)return SendClientMessage(playerid, Rot, "Fehler: Du bist zu weit vom Spieler entfernt!");
Tazer(tid, GetName(playerid));
return 1;
}
//DistanceCameraTargetToLocation
stock Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
{
new Float:TGTDistance;
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));
}
//Abfragen ob er auf eine Bestimme stelle geschossen hat
stock IsPlayerAimingAt(playerid, Float:pXx, Float:pYy, Float:pZz, 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, pXx, pYy, pZz, fx, fy, fz));
}