ich weiß nicht was da falsch ist aber wen ich /carlock mache und aus und einloge bleibt das car offen wen ich mehr malls /carlock mache bleibts trz offen und andere spieler können immer G oder F obwohl carlock aktiv ist
PHP
new Dtc_Carlock[700];new gCarLock[MAX_VEHICLES];
OnPlayerCarLogin(playerid);
for(new i = 0; i < 700; i++)
{
if(Dtc_Carlock[i])
{
SetVehicleParamsForPlayer(i,playerid,0,1);
}
}
if (gLastCar[playerid] > 0) {
gLastDriver[gLastCar[playerid]] = 300;
if(SpielerInfo[playerid][pPhousekey] != gLastCar[playerid]-1) {
gCarLock[gLastCar[playerid]] = 0;
UnLockCar(gLastCar[playerid]);
}
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
for(new x = 0; x < MaxVeh; x++)
{
if(Dtc_PlayerHaveCar[playerid][x])
{
if (vehicleid == PlayerCar[playerid][x][CarId])
{
if(SpielerInfo[playerid][pCarInsurance] == 1)
{
SendClientMessage(playerid,COLOR_YELLOW,"Dein Fahrzeug wurde zerstört, die Versicherung übernimmt 50%% der Kosten.");
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon]);
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon1]);
DestroyVehicle(PlayerCar[playerid][x][CarId]);
PlayerCar[playerid][x][CarLeben] = 1000;
PlayerCarSpawn(playerid,x);
PlayerMoney[playerid] = PlayerMoney[playerid] - PlayerCar[playerid][PlayerCar[playerid][x][CarId]][CarPreis] / 2;
}
else if(SpielerInfo[playerid][pCarInsurance] == 2)
{
SendClientMessage(playerid,COLOR_YELLOW,"Dein Fahrzeug wurde zerstört, die Versicherung übernimmt alle Kosten.");
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon]);
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon1]);
DestroyVehicle(PlayerCar[playerid][x][CarId]);
PlayerCar[playerid][x][CarLeben] = 1000;
PlayerCarSpawn(playerid,x);
} else {
Dtc_Carlock[PlayerCar[playerid][x][CarId]] = 0; //xxx 0
Dtc_UnLockCar(PlayerCar[playerid][x][CarId]);
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon]);
DestroyObject(Neonrohr[PlayerCar[playerid][x][CarId]][Neon1]);
DestroyVehicle(PlayerCar[playerid][x][CarId]);
new string3[256];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] = 0;
SendClientMessage(playerid,COLOR_YELLOW,"Dein Fahrzeug wurde zerstört, da du keine Versicherung hattest bekommst du nichts erstattet.");
format(string3, 256, "DELETE FROM `carsystem` WHERE `CarOwner`='%s_%d'",playername3, x);
mysql_query(string3);
}
if (strcmp("/carlock", cmdtext, true, 10) == 0) //carlockbug
{
if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
new Status = Dtc_Carlock[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]];
new Float:dtc_X,Float:dtc_Y,Float:dtc_Z;
GetVehiclePos(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId],dtc_X,dtc_Y,dtc_Z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,20.0,dtc_X,dtc_Y,dtc_Z))
{
PlayerPlaySound(i,1147,dtc_X,dtc_Y,dtc_Z);
}
}
switch (Status)
{
case 0:
{
GameTextForPlayer(playerid, "~w~Fahrzeug ~r~abgeschlossen", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
Dtc_Carlock[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]] = 1;
Dtc_LockCar(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]);
}
case 1:
{
GameTextForPlayer(playerid, "~w~Fahrzeug ~g~aufgeschlossen", 5000, 6);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
Dtc_Carlock[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]] = 0;
Dtc_UnLockCar(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Du besitzt Kein Fahrzeug für deinen Ausgewählten Schlüssel!");
return 1;
}
return 1; //carlockbug
if(strcmp("/carsell", cmdtext, true, 10) == 0) //carlockbug
{
if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
//CallRemoteFunction("moneygive","ii",playerid,PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPreis] / 2);
//GivePlayerMoney(playerid, PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPreis] / 2);
PlayerMoney[playerid] = PlayerMoney[playerid] + PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPreis] / 2;
Dtc_Carlock[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]] = 0; //xxx 0
Dtc_UnLockCar(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]);
DestroyVehicle(PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId]);
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
//format(string3, sizeof(string3), "/Autos/%s%d.dtcar", playername3,Dtc_PlayerKey[playerid]);
//fremove(string3);
format(string3, 256, "DELETE FROM `carsystem` WHERE `CarOwner`='%s_%d'",playername3,Dtc_PlayerKey[playerid]);
mysql_query(string3);
Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "Fahrzeug erfolgreich verkauft. Die Hälfte des Kaufpreises wurde dir erstattet!");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Fahrzeug!");
return 1;
}
return 1;
}
if (strcmp("/park", cmdtext, true, 10) == 0)
{
if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
{
new newcar = GetPlayerVehicleID(playerid);
if (newcar == PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarId])
{
new Float:X,Float:Y,Float:Z;
new Float:z_rot;
GetPlayerPos(playerid, X,Y,Z);
GetVehicleZAngle(newcar, z_rot);
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x] = X;
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y] = Y;
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z] = Z;
PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate] = z_rot;
SendClientMessage(playerid, COLOR_YELLOW, "Du hast dein Fahrzeug hier geparkt, ab jetzt kannst du dein Fahrzeug hier finden!");
}
else
{
SendClientMessage(playerid,COLOR_GREY,"Du bist nicht in deinem Fahrzeug/Du hast nicht den Schlüssel zu diesem Fahrzeug ausgewählt!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Du besitzt kein Fahrzeug für deinen ausgewählten Schlüssel!");
return 1;
}
return 1;
} //carlockbug
Alles anzeigen
MFG