hmm klappt imme noch nicht muss ich was in der Funktion machen ??
new
FireObj[MaxFire],
Float:FirePos[MaxFire][3],
TotalFires = 0,
FireHealth[MaxFire],
FireHealthMax[MaxFire];
#if defined Labels
new Text3D:FireText[MaxFire];
#endif
stock AddFire(Float:x, Float:y, Float:z, Health, FirID)
{
TotalFires++;
new fiID = TotalFires;
FireID[fiID] = FirID;
if(Health < 75) FireObj[fiID] = CreateDynamicObject(18692, x, y, z-3, 0, 0, 0.0);
else FireObj[fiID] = CreateDynamicObject(18691, x, y, z-3, 0, 0, 0.0);
FirePos[fiID][0] = x, FirePos[fiID][1] = y, FirePos[fiID][2] = z;
FireHealth[fiID] = Health;
FireHealthMax[fiID] = Health;
#if defined Labels
new fwstring[128];
format(fwstring, sizeof(fwstring), "%d/%d", FireHealth[fiID], FireHealthMax[fiID]);
FireText[fiID] = Create3DTextLabel(fwstring, 0xFFFFFFFFF, x, y, z, 20, 0);
#endif
//printf("Created fire on %.2f %.2f %.2f [ID %i]", x, y, z, ID);
return fiID;
}
stock DeleteFire(fmfiID)
{
DestroyDynamicObject(FireObj[fmfiID]);
TotalFires--;
FirePos[fmfiID][0] = 0, FirePos[fmfiID][1] = 0, FirePos[fmfiID][2] = 0;
#if defined Labels
Delete3DTextLabel(FireText[fmfiID]);
#endif
}
stock DeleteAllFire()
{
new ID;
for(ID = 0; ID<MaxFire; ID++)
{
DestroyDynamicObject(FireObj[ID]);
TotalFires= 0;
FirePos[ID][0] = 0, FirePos[ID][1] = 0, FirePos[ID][2] = 0;
#if defined Labels
Delete3DTextLabel(FireText[ID]);
#endif
}
}
stock IsValidFire(asfID)
{
if( (FirePos[asfID][0] != 0) && (FirePos[asfID][1] != 0) && (FirePos[asfID][2] != 0) ) return true;
else return false;
}
stock GetClosestFire(playerid)
{
new i;
for(i = 0; i<MaxFire; i++)
{
if(IsValidFire(i) && IsPlayerInRangeOfPoint(playerid, 1, FirePos[i][0], FirePos[i][1], FirePos[i][2]))
{
return i;
}
}
return 0;
}
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));
}
stock PlayerFaces(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));
}
public VehicleToPoint(Float:radi, vehicleid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetVehiclePos(vehicleid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}