Hallo samp forum....
Ich habe folgendes Problem das feuer was mann mit /feuer macht ist unter der erde und ich bekomme es auch nicht
wieder hoch ob mir da vtl. jemand helfen kann ?
MfG
Hallo samp forum....
Ich habe folgendes Problem das feuer was mann mit /feuer macht ist unter der erde und ich bekomme es auch nicht
wieder hoch ob mir da vtl. jemand helfen kann ?
MfG
einfach beim erstellen den z-Wert erhöhen. Entweder direkt in der Create-Funktion oder davor einfach
z+=WERT;
Ja vielleicht mit einem Link zum Script oder so?^^
Warscheinlich steht da irgendwo
CreateObject,ID Des Feuers,Float:X,Float:Y,Float:z); oder irgend sowas
Da müsste man dann einfach +2 bei Float Z machen...
Aber ka genau wie..
Also das ist mein Feuer System
#include <a_samp>
#pragma tabsize 0
#define VERSION "0.3a"
#define MAX_FLAMES 100 // maxmimal flames
#define BurnOthers // Should other players burn, too, if they are touching a burning player?
#define EarnMoney // Do you want to earn money for extinguish a fire?
#define FireMessageColor 0x00FF55FF // color used for the extinguish-message
#define German // German or English?
//#define MessageToAll // Should the extinguish-message be sent to all players?
#define FLAME_ZONE 1.2 // radius in which you start burning if you're too close to a flame
#define ONFOOT_RADIUS 1.5 // radius in which you can extinguish the flames by foot
#define PISSING_WAY 2.0 // radius in which you can extinguish the flames by peeing
#define CAR_RADIUS 8.0 // radius in which you can extinguish the flames by firetruck/SWAT Van
#define Z_DIFFERENCE 2.5 // height which is important for the accurancy of extinguishing. please do not change
#define EXTINGUISH_TIME_VEHICLE 1 // time you have to spray at the fire with a firetruck (seconds)
#define EXTINGUISH_TIME_ONFOOT 4 // time you have to spray at the fire onfoot (seconds)
#define EXTINGUISH_TIME_PEEING 10 // time you have to pee at the fire (seconds)
#define EXTINGUISH_TIME_PLAYER 3 // time it takes to extinguish a player (seconds)
#define FIRE_OBJECT_SLOT 1 // the slot used with SetPlayerAttachedObject and RemovePlayerAttachedObject
#if !defined SPECIAL_ACTION_PISSING
#define SPECIAL_ACTION_PISSING 68
#endif
//===================== forwards ====================
forward AddFire(Float:x, Float:y, Float:z);
forward KillFire(id);
forward DestroySmoke(id);
forward OnFireUpdate();
forward FireTimer(playerid, id);
forward SetPlayerBurn(playerid);
forward BurningTimer(playerid);
forward StopPlayerBurning(playerid);
forward AllowFireCMD();
forward ForbidFireCMD();
//===================== Variables ====================
enum FlameInfo
{
Flame_id,
Flame_Exists,
Float:Flame_x,
Float:Flame_y,
Float:Flame_z,
Smoke[5],
}
new firecmd;
new Flame[MAX_FLAMES][FlameInfo];
new ExtTimer[MAX_PLAYERS];
new PlayerOnFire[MAX_PLAYERS];
new PlayerOnFireTimer[MAX_PLAYERS];
new PlayerOnFireTimer2[MAX_PLAYERS];
new Float:PlayerOnFireHP[MAX_PLAYERS];
//===================== Normal Publics ====================
public OnGameModeInit() { OnFilterScriptInit(); }
public OnGameModeExit() { OnFilterScriptExit(); }
public OnFilterScriptInit()
{
AntiDeAMX();
AllowFireCMD();
print("\n /\\_/¯\\_/¯\\_/¯\\_/¯\\_/¯\\_/\\");
print(" < >");
#if defined German
print(" > Löschbares Feuer "#VERSION" <");
#else
print(" > Extinguishable Fire "#VERSION" <");
#endif
#if defined German
print(" < von Meta >");
#else
print(" < by Meta >");
#endif
print(" > www.iLife-Community.com <");
print(" < >");
print(" \\/¯\\_/¯\\_/¯\\_/¯\\_/¯\\_/¯\\/\n");
SetTimer("OnFireUpdate", 500, 1);
DestroyObject(35);
return 1;
}
public OnFilterScriptExit()
{
for(new i; i < MAX_FLAMES; i++)
{
KillFire(i);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx, cmd[256];
cmd = strtok(cmdtext, idx);
if(firecmd || IsPlayerAdmin(playerid))
{
#if defined German
if(strcmp("/feuer", cmd, true) == 0)
#else
if(strcmp("/fire", cmd, true) == 0)
#endif
{
new Float:x, Float:y, Float:z, Float:a;
GetXYInFrontOfPlayer(playerid, x, y, z, a, 2.5);
AddFire(x, y, z);
return 1;
}
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(PlayerOnFire[playerid])
{
#if defined German
SendClientMessage(playerid, 0xff000000, "Du bist verbrannt!"); StopPlayerBurning(playerid);
#else
SendClientMessage(playerid, 0xff000000, "You died because of the fire!"); StopPlayerBurning(playerid);
#endif
}
}
public OnFireUpdate()
{
for(new playerid; playerid < MAX_PLAYERS; playerid++)
{
if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) { continue; }
if(PlayerOnFire[playerid] && !CanPlayerBurn(playerid, 1))
{ StopPlayerBurning(playerid); }
if(Pissing_at_Flame(playerid) != -1 || Aiming_at_Flame(playerid) != -1)
{
#if defined German
GameTextForPlayer(playerid, " ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~~h~Feuer in Sicht", 1500, 6);
#else
GameTextForPlayer(playerid, " ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~~h~Flame ahead", 1500, 6);
#endif
if(!ExtTimer[playerid] && ((Aiming_at_Flame(playerid) != -1 && Pressing(playerid) & KEY_FIRE) || Pissing_at_Flame(playerid) != -1))
{
new value, time, Float:x, Float:y, Float:z;
if(Pissing_at_Flame(playerid) != -1)
{
value = Pissing_at_Flame(playerid);
time = EXTINGUISH_TIME_PEEING;
}
else if(Aiming_at_Flame(playerid) != -1)
{
value = Aiming_at_Flame(playerid);
if(GetPlayerWeapon(playerid) == 41)
{
CreateExplosion(Flame[value][Flame_x], Flame[value][Flame_y], Flame[value][Flame_z], 2, 5);
continue;
}
if(IsPlayerInAnyVehicle(playerid))
{
time = EXTINGUISH_TIME_VEHICLE;
}
else
{
time = EXTINGUISH_TIME_ONFOOT;
}
}
if(value < -1) { time = EXTINGUISH_TIME_PLAYER; }
time *= 1000;
if(value >= -1)
{
x = Flame[value][Flame_x];
y = Flame[value][Flame_y];
z = Flame[value][Flame_z];
DestroySmoke(value);
Flame[value][Smoke][0] = CreateObject(18727, x, y, z, 0.0, 0.0, 0.0);
Flame[value][Smoke][1] = CreateObject(18727, x+1, y, z, 0.0, 0.0, 0.0);
Flame[value][Smoke][2] = CreateObject(18727, x-1, y, z, 0.0, 0.0, 0.0);
Flame[value][Smoke][3] = CreateObject(18727, x, y+1, z, 0.0, 0.0, 0.0);
Flame[value][Smoke][4] = CreateObject(18727, x, y-1, z, 0.0, 0.0, 0.0);
SetTimerEx("DestroySmoke", time, 0, "d", value);
}
ExtTimer[playerid] = SetTimerEx("FireTimer", time, 0, "dd", playerid, value);
}
}
if(CanPlayerBurn(playerid) && IsAtFlame(playerid)) { SetPlayerBurn(playerid); }
#if defined BurnOthers
new Float:x, Float:y, Float:z;
for(new i; i < MAX_PLAYERS; i++)
{
if(playerid != i && IsPlayerConnected(i) && !IsPlayerNPC(i))
{
if(CanPlayerBurn(i) && PlayerOnFire[playerid] && !PlayerOnFire[i])
{
GetPlayerPos(i, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 1, x, y, z))
{
SetPlayerBurn(i);
}
}
}
}
#endif
}
return 1;
}
//===================== stocks ====================
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, &Float:z, &Float:a, Float:distance)
{
GetPlayerPos(playerid, x, y ,z);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid),a);
}
else
{
GetPlayerFacingAngle(playerid, a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return 0;
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[256];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
stock ReturnUser(text[])
{
new pos = 0;
while (text[pos] < 0x21)
{
if(text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if(isNumeric(text[pos]))
{
userid = strval(text[pos]);
if(userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
userid = INVALID_PLAYER_ID;
else return userid;
}
}
new len = strlen(text[pos]);
new count = 0;
new pname[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, pname, sizeof (pname));
if(strcmp(pname, text[pos], true, len) == 0)
{
if(len == strlen(pname)) return i;
else
{
count++;
userid = i;
}
}
}
}
if(count != 1)
{
userid = INVALID_PLAYER_ID;
}
return userid;
}
stock isNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if ((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') /*Not a number,'+' or '-'*/|| (string[i]=='-' && i!=0)/* A '-' but not at first.*/|| (string[i]=='+' && i!=0)/* A '+' but not at first.*/)
{
return false;
}
}
if (length==1 && (string[0]=='-' || string[0]=='+')) { return false; }
return true;
}
stock Float:GetDistanceBetweenPoints(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2) //By Gabriel "Larcius" Cordes
{
return floatadd(floatadd(floatsqroot(floatpower(floatsub(x1,x2),2)),floatsqroot(floatpower(floatsub(y1,y2),2))),floatsqroot(floatpower(floatsub(z1,z2),2)));
}
stock 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));
}
//===================== Own Publics ====================
public AddFire(Float:x, Float:y, Float:z)
{
new slot = GetFlameSlot();
if(slot == -1) {return slot;}
Flame[slot][Flame_Exists] = 1;
Flame[slot][Flame_x] = x;
Flame[slot][Flame_y] = y;
Flame[slot][Flame_z] = z - Z_DIFFERENCE;
Flame[slot][Flame_id] = CreateObject(18689, Flame[slot][Flame_x], Flame[slot][Flame_y], Flame[slot][Flame_z], 0.0, 0.0, 0.0);
return slot;
}
public KillFire(id)
{
DestroyObject(Flame[id][Flame_id]);
Flame[id][Flame_Exists] = 0;
Flame[id][Flame_x] = 0.0;
Flame[id][Flame_y] = 0.0;
Flame[id][Flame_z] = 0.0;
DestroySmoke(id);
}
public DestroySmoke(id)
{
for(new i; i < 5; i++) { DestroyObject(Flame[id][Smoke][i]); }
}
public FireTimer(playerid, id)
{
if(id < -1 && Aiming_at_Flame(playerid) == id) { StopPlayerBurning(id+MAX_PLAYERS); }
else if(id < -1 && Pissing_at_Flame(playerid) == id) { StopPlayerBurning(id+MAX_PLAYERS); }
else if(Flame[id][Flame_Exists] && ((Pressing(playerid) & KEY_FIRE && Aiming_at_Flame(playerid) == id) || (Pissing_at_Flame(playerid) == id)))
{
new sendername[MAX_PLAYER_NAME+26];
GetPlayerName(playerid, sendername, sizeof(sendername));
#if defined MessageToAll
if(Pissing_at_Flame(playerid) == id)
{
#if defined German
format(sendername, sizeof(sendername), "* %s hat einen Brand ausgepisst! *", sendername);
#else
format(sendername, sizeof(sendername), "* %s pissed out a fire! *", sendername);
#endif
}
else if(Aiming_at_Flame(playerid) == id)
{
#if defined German
format(sendername, sizeof(sendername), "* %s hat einen Brand gelöscht! *", sendername);
#else
format(sendername, sizeof(sendername), "* %s extinguished a fire! *", sendername);
#endif
}
SendClientMessageToAll(FireMessageColor, sendername);
#else
if(Pissing_at_Flame(playerid) == id)
{
#if defined German
SendClientMessage(playerid, FireMessageColor, "* Du hast einen Brand ausgepisst! *");
#else
SendClientMessage(playerid, FireMessageColor, "* You pissed out a fire! *");
#endif
}
else if(Aiming_at_Flame(playerid) == id)
{
#if defined German
SendClientMessage(playerid, FireMessageColor, "* Du hast einen Brand gelöscht! *");
#else
SendClientMessage(playerid, FireMessageColor, "* You extinguished a fire! *");
#endif
}
#endif
KillFire(id);
#if defined EarnMoney
GivePlayerMoney(playerid, 500);
#endif
}
KillTimer(ExtTimer[playerid]);
ExtTimer[playerid] = 0;
}
public SetPlayerBurn(playerid)
{
SetPlayerAttachedObject(playerid, FIRE_OBJECT_SLOT, 18690, 2, -1, 0, -1.9, 0, 0);
PlayerOnFire[playerid] = 1;
GetPlayerHealth(playerid, PlayerOnFireHP[playerid]);
KillTimer(PlayerOnFireTimer[playerid]); KillTimer(PlayerOnFireTimer2[playerid]);
PlayerOnFireTimer[playerid] = SetTimerEx("BurningTimer", 91, 1, "d", playerid);
PlayerOnFireTimer2[playerid] = SetTimerEx("StopPlayerBurning", 7000, 0, "d", playerid);
return 1;
}
public BurningTimer(playerid)
{
if(PlayerOnFire[playerid])
{
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp < PlayerOnFireHP[playerid])
{
PlayerOnFireHP[playerid] = hp;
}
SetPlayerHealth(playerid, PlayerOnFireHP[playerid]-1.0);
PlayerOnFireHP[playerid] -= 1.0;
}
else { KillTimer(PlayerOnFireTimer[playerid]); KillTimer(PlayerOnFireTimer2[playerid]); }
}
public StopPlayerBurning(playerid)
{
KillTimer(PlayerOnFireTimer[playerid]);
PlayerOnFire[playerid] = 0;
RemovePlayerAttachedObject(playerid, FIRE_OBJECT_SLOT);
}
public AllowFireCMD()
{
firecmd = 1;
}
public ForbidFireCMD()
{
firecmd = 0;
}
//===================== Other Functions ====================
stock GetFireID(Float:x, Float:y, Float:z, &Float:dist)
{
new id = -1;
dist = 99999.99;
for(new i; i < MAX_FLAMES; i++)
{
if(GetDistanceBetweenPoints(x,y,z,Flame[i][Flame_x],Flame[i][Flame_y],Flame[i][Flame_z]) < dist)
{
dist = GetDistanceBetweenPoints(x,y,z,Flame[i][Flame_x],Flame[i][Flame_y],Flame[i][Flame_z]);
id = i;
}
}
return id;
}
CanPlayerBurn(playerid, val = 0)
{
if(CallRemoteFunction("CanBurn", "d", playerid) >= 0 && !IsPlayerInWater(playerid) && GetPlayerSkin(playerid) != 277 && GetPlayerSkin(playerid) != 278 && GetPlayerSkin(playerid) != 279 && ((!val && !PlayerOnFire[playerid]) || (val && PlayerOnFire[playerid]))) { return 1; }
return 0;
}
/* //Uncomment or copy to your script.
forward CanBurn(playerid);
public CanBurn(playerid)
{
if(...)
{
return 1;
}
return -1; // IMPORTANT!
}
*/
stock IsPlayerInWater(playerid)
{
new Float:X, Float:Y, Float:Z, an = GetPlayerAnimationIndex(playerid);
GetPlayerPos(playerid, X, Y, Z);
if((1544 >= an >= 1538 || an == 1062 || an == 1250) && (Z <= 0 || (Z <= 41.0 && IsPlayerInArea(playerid, -1387, -473, 2025, 2824))) ||
(1544 >= an >= 1538 || an == 1062 || an == 1250) && (Z <= 2 || (Z <= 39.0 && IsPlayerInArea(playerid, -1387, -473, 2025, 2824))))
{
return 1;
}
return 0;
}
stock IsPlayerInArea(playerid, Float:MinX, Float:MaxX, Float:MinY, Float:MaxY)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
#pragma unused z
if(x >= MinX && x <= MaxX && y >= MinY && y <= MaxY) { return 1; }
return 0;
}
GetFlameSlot()
{
for(new i = 0; i < MAX_FLAMES; i++)
{
if(!Flame[i][Flame_Exists]) { return i; }
}
return -1;
}
//===================== "Callbacks" ====================
IsAtFlame(playerid)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(Flame[i][Flame_Exists])
{
if(!IsPlayerInAnyVehicle(playerid) && (IsPlayerInRangeOfPoint(playerid, FLAME_ZONE, Flame[i][Flame_x], Flame[i][Flame_y], Flame[i][Flame_z]+Z_DIFFERENCE) ||
IsPlayerInRangeOfPoint(playerid, FLAME_ZONE, Flame[i][Flame_x], Flame[i][Flame_y], Flame[i][Flame_z]+Z_DIFFERENCE-1)))
{
return 1;
}
}
}
return 0;
}
Aiming_at_Flame(playerid)
{
new id = -1;
new Float:dis = 99999.99;
new Float:dis2;
new Float:px, Float:py, Float:pz;
new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
GetPlayerCameraPos(playerid, cx, cy, cz);
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerOnFire[i] && (IsInWaterCar(playerid) || HasExtinguisher(playerid) || GetPlayerWeapon(playerid) == 41) && PlayerOnFire[i])
{
GetPlayerPos(i, px, py, pz);
dis2 = DistanceCameraTargetToLocation(cx, cy, cz, px, py, pz, fx, fy, fz);
if(dis2 < dis)
{
dis = dis2;
id = i;
}
}
}
if(id != -1) { return id-MAX_PLAYERS; }
for(new i; i < MAX_FLAMES; i++)
{
if(Flame[i][Flame_Exists])
{
if(IsInWaterCar(playerid) || HasExtinguisher(playerid) || GetPlayerWeapon(playerid) == 41)
{
dis2 = DistanceCameraTargetToLocation(cx, cy, cz, Flame[i][Flame_x], Flame[i][Flame_y], Flame[i][Flame_z]+Z_DIFFERENCE, fx, fy, fz);
if(IsPlayerInAnyVehicle(playerid) && dis2 < CAR_RADIUS && dis2 < dis)
{
dis = dis2;
id = i;
}
else if(!IsPlayerInAnyVehicle(playerid) && dis2 < ONFOOT_RADIUS && dis2 < dis)
{
dis = dis2;
id = i;
}
}
}
}
if(id != -1)
{
if
(
(
IsPlayerInAnyVehicle(playerid) && !IsPlayerInRangeOfPoint(playerid, 50, Flame[id][Flame_x], Flame[id][Flame_y], Flame[id][Flame_z])
)
||
(
!IsPlayerInAnyVehicle(playerid) && !IsPlayerInRangeOfPoint(playerid, 5, Flame[id][Flame_x], Flame[id][Flame_y], Flame[id][Flame_z])
)
)
{ id = -1; }
}
return id;
}
Pissing_at_Flame(playerid)
{
new id = -1;
new Float:dis = 99999.99, Float:dis2;
new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1,Float:a;
GetXYInFrontOfPlayer(playerid, x, y, z, a, 1);
z -= Z_DIFFERENCE;
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_PISSING)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerOnFire[i] && PlayerOnFire[i])
{
GetPlayerPos(i, x1, y1, z1);
if(IsPlayerInRangeOfPoint(playerid, ONFOOT_RADIUS, x1, y1, z1))
{
id = i;
}
}
}
if(id != -1) { return id-MAX_PLAYERS; }
for(new i; i < MAX_FLAMES; i++)
{
if(Flame[i][Flame_Exists])
{
if(!IsPlayerInAnyVehicle(playerid))
{
dis2 = GetDistanceBetweenPoints(x,y,z,Flame[i][Flame_x],Flame[i][Flame_y],Flame[i][Flame_z]);
if(dis2 < PISSING_WAY && dis2 < dis)
{
id = i;
dis = dis2;
}
}
}
}
}
return id;
}
IsInWaterCar(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 407 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 601) { return 1; }
return 0;
}
HasExtinguisher(playerid)
{
if(GetPlayerWeapon(playerid) == 42 && !IsPlayerInAnyVehicle(playerid)) { return 1; }
return 0;
}
Pressing(playerid)
{
new keys, updown, leftright;
GetPlayerKeys(playerid, keys, updown, leftright);
return keys;
}
//===================== Important Shit ====================
AntiDeAMX()
{
new Furz[][] =
{
"Muha",
"lol xD"
};
#pragma unused Furz
}
Koordinaten überprüft?
Also es ist ja so mann kann bei uns /feuer machen aber denn ist es unter der map