Hallo,
ich hab grad ein Feuerwehrsystem gemacht, aber wenn ich mit dem Feuerlöscher drauf sprüh geht es net aus. Ich hab es Scriptlich festgelegt, damit es aus geht, aber es geht trzdm net
enum fires
{
ID,
Float:zX,
Float:zY,
Float:zZ
}
#define MAX_FIRES 100
new bfire;
new fire[MAX_FIRES][fires] = {
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0},
{"", 0.0, 0.0, 0.0}
};
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/feuerzünden", true) == 0)
{
if(bfire < MAX_FIRES)
{
new Float:p[3];
GetPlayerPos(playerid, p[0], p[1], p[2]);
bfire += 1;
fire[bfire][ID] = CreateObject(18692, p[0], p[1], p[2]-2, 0.0, 0.0, 0.0);
fire[bfire][zX] = p[0];
fire[bfire][zY] = p[1];
fire[bfire][zZ] = p[2];
}
return 1;
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid)
{
if(weaponid == 42)
{
for(new i=0; i<MAX_FIRES;i++)
{
if(GetPlayerDistanceFromPoint(playerid, fire[i][zX], fire[i][zY], fire[i][zZ]) < 10)
{
new Float:z[2];
GetXYInFrontOfPlayer(playerid, z[0], z[1], GetPlayerDistanceFromPoint(playerid, fire[i][zX], fire[i][zX], fire[i][zZ]));
if(z[0] == fire[i][zX] && z[1] == fire[i][zY])
{
DestroyObject(fire[i][ID]);
SendClientMessage(playerid, COLOR_GREEN, "Feuer gelöscht!");
}
}
}
}
return 1;
}
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a),GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Was ist da falsch?
PS GetXYInFrontOfPlayer ist von Kalieber