Der Blitzer funktioniert nicht hier.
ocmd:blitzererstellen(playerid,params[])
{
new Slot, Speed, Pos[128];
if(sscanf(params, "dds", Slot, Speed, Pos))
{
return SendClientMessage(playerid,COLOR_RED,"Benutzung: /blitzererstellen [Slot] [Geschwindigkeit] [Position]");
}
if(Slot>5) return SendClientMessage(playerid, ROT, "Nutze die Blitzerslots von 1-5!");
if(Slot<1) return SendClientMessage(playerid, ROT, "Nutze die Blitzerslots von 1-5!");
if(Slot == 1)
{
if(Blitzer1 == 1) return SendClientMessage(playerid, BLAU, "Jemand hat einen Blitzer mit dieser ID bereits aufgebaut!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Blitzer1 = 1;
Blitzer1Speed = Speed;
Blitzer1Pos = Pos;
Blitzer1X = X;
Blitzer1Y = Y,
Blitzer1Z = Z;
Blitzer1Owner = playerid;
CreateObject(18880, X + 1.0, Y + 1.0, Z - 2.2, 0.0, 0.0, 10);
new string[128];
format(string, sizeof(string), "Du hast erfolgreich Blitzer 1 mit %d km/h aufgebaut!", Speed);
SendClientMessage(playerid, BLAU, string);
return 1;
}
if(Slot == 2)
{
if(Blitzer2 == 1) return SendClientMessage(playerid, ROT, "Jemand hat einen Blitzer mit dieser ID bereits aufgebaut!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Blitzer2 = 1;
Blitzer2Speed = Speed;
Blitzer2Pos = Pos;
Blitzer2X = X;
Blitzer2Y = Y,
Blitzer2Z = Z;
Blitzer2Owner = playerid;
CreateObject(18880, X + 1.0, Y + 1.0, Z - 2.2, 0.0, 0.0, 10);
new string[128];
format(string, sizeof(string), "Du hast erfolgreich Blitzer 2 mit %d km/h aufgebaut!", Speed);
SendClientMessage(playerid, BLAU, string);
return 1;
}
if(Slot == 3)
{
if(Blitzer3 == 1) return SendClientMessage(playerid, ROT, "Jemand hat einen Blitzer mit dieser ID bereits aufgebaut!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Blitzer3 = 1;
Blitzer3Speed = Speed;
Blitzer3Pos = Pos;
Blitzer3X = X;
Blitzer3Y = Y,
Blitzer3Z = Z;
Blitzer3Owner = playerid;
CreateObject(18880, X + 1.0, Y + 1.0, Z - 2.2, 0.0, 0.0, 10);
new string[128];
format(string, sizeof(string), "Du hast erfolgreich Blitzer 3 mit %d km/h aufgebaut!", Speed);
SendClientMessage(playerid, BLAU, string);
return 1;
}
if(Slot == 4)
{
if(Blitzer4 == 1) return SendClientMessage(playerid, ROT, "Jemand hat einen Blitzer mit dieser ID bereits aufgebaut!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Blitzer4 = 1;
Blitzer4Speed = Speed;
Blitzer4Pos = Pos;
Blitzer4X = X;
Blitzer4Y = Y;
Blitzer4Z = Z;
Blitzer4Owner = playerid;
CreateObject(18880, X + 1.0, Y + 1.0, Z - 2.2, 0.0, 0.0, 10);
new string[128];
format(string, sizeof(string), "Du hast erfolgreich Blitzer 4 mit %d km/h aufgebaut!", Speed);
SendClientMessage(playerid, BLAU, string);
return 1;
}
if(Slot == 5)
{
if(Blitzer5 == 1) return SendClientMessage(playerid, ROT, "Jemand hat einen Blitzer mit dieser ID bereits aufgebaut!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Blitzer5 = 1;
Blitzer5Speed = Speed;
Blitzer5Pos = Pos;
Blitzer5X = X;
Blitzer5Y = Y,
Blitzer5Z = Z;
Blitzer5Owner = playerid;
CreateObject(18880, X + 1.0, Y + 1.0, Z - 2.2, 0.0, 0.0, 10);
new string[128];
format(string, sizeof(string), "Du hast erfolgreich Blitzer 5 mit %d km/h aufgebaut!", Speed);
SendClientMessage(playerid, BLAU, string);
return 1;
}
return 1;
}
public
public IsAtBlitzer(playerid)
{
new carid = GetVehicleModel(GetPlayerVehicleID(playerid));
if(IsPlayerInVehicle(playerid,carid))
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, Blitzer1X, Blitzer1Y, Blitzer1Z))
{
if(Blitzer1 == 1)
{
new speed;
new Float:xg,Float:yg,Float:zg;
new Float:distance,value;
GetPlayerPos(playerid,xg,yg,zg);
distance = floatsqroot(floatpower(floatabs(floatsub(xg,SavedPOSx[playerid])),2)+floatpower(floatabs(floatsub(yg,SavedPOSy[playerid])),2)+floatpower(floatabs(floatsub(zg,SavedPOSz[playerid])),2));
value = floatround(distance * 11000);
SavedPOSx[playerid] = xg;
SavedPOSy[playerid] = yg;
SavedPOSz[playerid] = zg;
speed=floatround(value/3200);
if(speed > Blitzer1Speed)
{
if(IsPlayerInRangeOfPoint(Blitzer1Owner, 20.0, Blitzer1X, Blitzer1Y, Blitzer1Z))
{
new zuschnell = (speed-Blitzer1Speed);
new strafgeld = (zuschnell*10);
GivePlayerMoney(playerid, -strafgeld);
new string[128], string2[128], owner[MAX_PLAYER_NAME], driver[MAX_PLAYER_NAME];
GetPlayerName(playerid, owner, sizeof(owner));
GetPlayerName(Blitzer1Owner, driver, sizeof(driver));
format(string, sizeof(string), "[BLITZER] %s ist %d km/h zu schnell durch den Blitzer von %s gefahren.", driver, zuschnell, owner);
format(string2, sizeof(string2), "[BLITZER] Geschwindigkeit: %d km/h | Maximalgeschwindigkeit: %d km/h | Bußgeld: %d$", speed, Blitzer1Speed, strafgeld);
SendClientMessage(playerid, BLAU, string);
SendClientMessage(playerid, BLAU, string2);
return 1;
}
}
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, Blitzer2X, Blitzer2Y, Blitzer2Z))
{
if(Blitzer2 == 1)
{
new speed;
new Float:xg,Float:yg,Float:zg;
new Float:distance,value;
GetPlayerPos(playerid,xg,yg,zg);
distance = floatsqroot(floatpower(floatabs(floatsub(xg,SavedPOSx[playerid])),2)+floatpower(floatabs(floatsub(yg,SavedPOSy[playerid])),2)+floatpower(floatabs(floatsub(zg,SavedPOSz[playerid])),2));
value = floatround(distance * 11000);
SavedPOSx[playerid] = xg;
SavedPOSy[playerid] = yg;
SavedPOSz[playerid] = zg;
speed=floatround(value/3200);
if(speed > Blitzer2Speed)
{
if(IsPlayerInRangeOfPoint(Blitzer2Owner, 20.0, Blitzer2X, Blitzer2Y, Blitzer2Z))
{
new zuschnell = (speed-Blitzer2Speed);
new strafgeld = (zuschnell*10);
GivePlayerMoney(playerid, -strafgeld);
new string[128], string2[128], owner[MAX_PLAYER_NAME], driver[MAX_PLAYER_NAME];
GetPlayerName(playerid, owner, sizeof(owner));
GetPlayerName(Blitzer2Owner, driver, sizeof(driver));
format(string, sizeof(string), "[BLITZER] %s ist %d km/h zu schnell durch den Blitzer von %s gefahren.", driver, zuschnell, owner);
format(string2, sizeof(string2), "[BLITZER] Geschwindigkeit: %d km/h | Maximalgeschwindigkeit: %d km/h | Bußgeld: %d$", speed, Blitzer2Speed, strafgeld);
SendClientMessage(playerid, BLAU, string);
SendClientMessage(playerid, BLAU, string2);
return 1;
}
}
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, Blitzer3X, Blitzer3Y, Blitzer3Z))
{
if(Blitzer3 == 1)
{
new speed;
new Float:xg,Float:yg,Float:zg;
new Float:distance,value;
GetPlayerPos(playerid,xg,yg,zg);
distance = floatsqroot(floatpower(floatabs(floatsub(xg,SavedPOSx[playerid])),2)+floatpower(floatabs(floatsub(yg,SavedPOSy[playerid])),2)+floatpower(floatabs(floatsub(zg,SavedPOSz[playerid])),2));
value = floatround(distance * 11000);
SavedPOSx[playerid] = xg;
SavedPOSy[playerid] = yg;
SavedPOSz[playerid] = zg;
speed=floatround(value/3200);
if(speed > Blitzer3Speed)
{
if(IsPlayerInRangeOfPoint(Blitzer3Owner, 20.0, Blitzer3X, Blitzer3Y, Blitzer3Z))
{
new zuschnell = (speed-Blitzer3Speed);
new strafgeld = (zuschnell*10);
GivePlayerMoney(playerid, -strafgeld);
new string[128], string2[128], owner[MAX_PLAYER_NAME], driver[MAX_PLAYER_NAME];
GetPlayerName(playerid, owner, sizeof(owner));
GetPlayerName(Blitzer3Owner, driver, sizeof(driver));
format(string, sizeof(string), "[BLITZER] %s ist %d km/h zu schnell durch den Blitzer von %s gefahren.", driver, zuschnell, owner);
format(string2, sizeof(string2), "[BLITZER] Geschwindigkeit: %d km/h | Maximalgeschwindigkeit: %d km/h | Bußgeld: %d$", speed, Blitzer3Speed, strafgeld);
SendClientMessage(playerid, BLAU, string);
SendClientMessage(playerid, BLAU, string2);
return 1;
}
}
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, Blitzer4X, Blitzer4Y, Blitzer4Z))
{
if(Blitzer4 == 1)
{
new speed;
new Float:xg,Float:yg,Float:zg;
new Float:distance,value;
GetPlayerPos(playerid,xg,yg,zg);
distance = floatsqroot(floatpower(floatabs(floatsub(xg,SavedPOSx[playerid])),2)+floatpower(floatabs(floatsub(yg,SavedPOSy[playerid])),2)+floatpower(floatabs(floatsub(zg,SavedPOSz[playerid])),2));
value = floatround(distance * 11000);
SavedPOSx[playerid] = xg;
SavedPOSy[playerid] = yg;
SavedPOSz[playerid] = zg;
speed=floatround(value/3200);
if(speed > Blitzer4Speed)
{
if(IsPlayerInRangeOfPoint(Blitzer4Owner, 20.0, Blitzer4X, Blitzer4Y, Blitzer4Z))
{
new zuschnell = (speed-Blitzer4Speed);
new strafgeld = (zuschnell*10);
GivePlayerMoney(playerid, -strafgeld);
new string[128], string2[128], owner[MAX_PLAYER_NAME], driver[MAX_PLAYER_NAME];
GetPlayerName(playerid, owner, sizeof(owner));
GetPlayerName(Blitzer4Owner, driver, sizeof(driver));
format(string, sizeof(string), "[BLITZER] %s ist %d km/h zu schnell durch den Blitzer von %s gefahren.", driver, zuschnell, owner);
format(string2, sizeof(string2), "[BLITZER] Geschwindigkeit: %d km/h | Maximalgeschwindigkeit: %d km/h | Bußgeld: %d$", speed, Blitzer4Speed, strafgeld);
SendClientMessage(playerid, BLAU, string);
SendClientMessage(playerid, BLAU, string2);
return 1;
}
}
}
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 10.0, Blitzer5X, Blitzer5Y, Blitzer5Z))
{
if(Blitzer5 == 1)
{
new speed;
new Float:xg,Float:yg,Float:zg;
new Float:distance,value;
GetPlayerPos(playerid,xg,yg,zg);
distance = floatsqroot(floatpower(floatabs(floatsub(xg,SavedPOSx[playerid])),2)+floatpower(floatabs(floatsub(yg,SavedPOSy[playerid])),2)+floatpower(floatabs(floatsub(zg,SavedPOSz[playerid])),2));
value = floatround(distance * 11000);
SavedPOSx[playerid] = xg;
SavedPOSy[playerid] = yg;
SavedPOSz[playerid] = zg;
speed=floatround(value/3200);
if(speed > Blitzer5Speed)
{
if(IsPlayerInRangeOfPoint(Blitzer5Owner, 20.0, Blitzer5X, Blitzer5Y, Blitzer5Z))
{
new zuschnell = (speed-Blitzer5Speed);
new strafgeld = (zuschnell*10);
GivePlayerMoney(playerid, -strafgeld);
new string[128], string2[128], owner[MAX_PLAYER_NAME], driver[MAX_PLAYER_NAME];
GetPlayerName(playerid, owner, sizeof(owner));
GetPlayerName(Blitzer1Owner, driver, sizeof(driver));
format(string, sizeof(string), "[BLITZER] %s ist %d km/h zu schnell durch den Blitzer von %s gefahren.", driver, zuschnell, owner);
format(string2, sizeof(string2), "[BLITZER] Geschwindigkeit: %d km/h | Maximalgeschwindigkeit: %d km/h | Bußgeld: %d$", speed, Blitzer5Speed, strafgeld);
SendClientMessage(playerid, BLAU, string);
SendClientMessage(playerid, BLAU, string2);
return 1;
}
}
}
return 1;
}
}
else
{
}
return 0;
}