Hallo Breadfish,
ich habe schon wieder ein Problem.
Ich habe ein Unfall filterscript und das geht nicht.
Von Funsocke
ZitatAlles anzeigen#include <a_samp>
forward IfAutoKaputtTimer(playerid);
forward Float:GetDistanceBetweenPlayers(p1,p2);
#define COLOR_RED 0xE60000FF
#define COLOR_WHITE 0xFFFFFFFF
static bool:PlayerMessageMotorschaden[MAX_PLAYERS] = { false };
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Unfall system By Funsocke");
print("--------------------------------------\n");
SetTimer("IfAutoKaputtTimer", 1000, 1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerMessageMotorschaden[playerid] = false;
return 1;
}
public Float:GetDistanceBetweenPlayers(p1,p2){
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
if (!IsPlayerConnected(p1) !IsPlayerConnected(p2)){
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x2,y2,z2);
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
public IfAutoKaputtTimer(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new VID, Float:h_vid;
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
{
VID = GetPlayerVehicleID(playerid);
GetVehicleHealth(VID, h_vid);
if(h_vid <= 300 && PlayerMessageMotorschaden[playerid] == false)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, 0xFF6900AA, "Du hast ein Unfall gebaut. Rufe die /112");
PlayerMessageMotorschaden[playerid] = true;
SetVehicleHealth(vehicleid, 300.0);
SetPlayerHealth(playerid,100);
} }
}