Hey
Warum funktioniert das nicht immer wenn ich einsteige und /buygangcar mache geht es nicht mehr weiter:
if(strcmp("/buygangcar", cmd, true) == 0)
{
if(PlayerInfo[playerid][pLeader] != -1 || PlayerInfo[playerid][pRank] == 12)
{
new Farbe,
GangCars = 0;
if(PlayerInfo[playerid][pTeam] == 4 || PlayerInfo[playerid][pTeam] == 14 || PlayerInfo[playerid][pTeam] == 7 || PlayerInfo[playerid][pTeam] == 16)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Deine Fraktion ist nicht Berechtigt Gangautos zu Kaufen.");
return 1;
}
if(IsPlayerInAnyVehicle(playerid) && GangAutoSpectating[playerid] != -1)
{
new GangAutoPreis = GangAutoKaufliste[GangAutoSpectating[playerid]][GAPreis];
if(GangAutoPreis >= KassenInfo[PlayerInfo[playerid][pTeam]][tKasse])
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Es ist nicht mehr genug Geld in der Teamkasse !");
return 1;
}
else
{
if(PlayerInfo[playerid][pTeam] == 1)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pTeam] == 2)
{
Farbe = 154;
}
if(PlayerInfo[playerid][pTeam] == 3)
{
Farbe = 120;
}
if(PlayerInfo[playerid][pTeam] == 4)
{
Farbe = 3;
}
if(PlayerInfo[playerid][pTeam] == 5)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pTeam] == 6)
{
Farbe = 8;
}
if(PlayerInfo[playerid][pTeam] == 7)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 8)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 9)
{
Farbe = 61;
}
if(PlayerInfo[playerid][pTeam] == 10)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 11)
{
Farbe = 1;
}
if(PlayerInfo[playerid][pTeam] == 12)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pTeam] == 13)
{
Farbe = 1;
}
if(PlayerInfo[playerid][pTeam] == 14)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 15)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pTeam] == 16)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 17)
{
Farbe = 152;
}
if(PlayerInfo[playerid][pTeam] == 18)
{
Farbe = 93;
}
if(PlayerInfo[playerid][pTeam] == 19)
{
Farbe = 86;
}
if(PlayerInfo[playerid][pTeam] == 20)
{
Farbe = 85;
}
if(PlayerInfo[playerid][pTeam] == 21)
{
Farbe = 66;
}
if(PlayerInfo[playerid][pTeam] == 22)
{
Farbe = 79;
}
if(PlayerInfo[playerid][pTeam] == 23)
{
Farbe = 3;
}
if(PlayerInfo[playerid][pTeam] == 24)
{
Farbe = 6;
}
if(PlayerInfo[playerid][pTeam] == 25)
{
Farbe = 104;
}
if(PlayerInfo[playerid][pTeam] == 26)
{
Farbe = 123;
}
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(GangAutoInfo[h][cOwner] == PlayerInfo[playerid][pTeam])
{
GangCars += 1;
}
if(GangCars >= 25)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Deine Gang hat schon 25 Gangautos!");
return 1;
}
}
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(GangAutoInfo[h][cOwner] == -1 && GangAutoInfo[h][cTyp] == -1 && GangAutoInfo[h][cColor1] == -1 && GangAutoInfo[h][cColor2] == -1){
GangAutoInfo[h][cOwner] = PlayerInfo[playerid][pTeam];
GangAutoInfo[h][cID] = -1;
GangAutoInfo[h][cTyp] = GangAutoKaufliste[GangAutoSpectating[playerid]][GAModelid];
new Zufall = random(4);
if(Zufall == 0)
{
GangAutoInfo[h][cPosX] = 391;
GangAutoInfo[h][cPosY] = 2442;
GangAutoInfo[h][cPosZ] = 18;
}
else if(Zufall == 1)
{
GangAutoInfo[h][cPosX] = 401;
GangAutoInfo[h][cPosY] = 2442;
GangAutoInfo[h][cPosZ] = 18;
}
else if(Zufall == 2)
{
GangAutoInfo[h][cPosX] = 411;
GangAutoInfo[h][cPosY] = 2442;
GangAutoInfo[h][cPosZ] = 18;
}
else
{
GangAutoInfo[h][cPosX] = 421;
GangAutoInfo[h][cPosY] = 2442;
GangAutoInfo[h][cPosZ] = 18;
}
GangAutoInfo[h][cRot] = 90;
GangAutoInfo[h][cColor1] = Farbe;
GangAutoInfo[h][cColor2] = Farbe;
GangAutoInfo[h][cStatus] = 0;
GangAutoInfo[h][cTank] = 100;
GangAutoInfo[h][cMeter] = 0;
CreateNewlyGangAutos(h);
KassenInfo[PlayerInfo[playerid][pTeam]][tKasse] -= GangAutoPreis;
format(string, sizeof(string), "Gang Car erfolgreich gekauft für %s$, das Geld wurde von der Teamkasse abgezogen.", GetPoint(GangAutoPreis));
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPlayerCheckpoint(playerid,403.7779,2478.6750,16.4844,5.0);
SendClientMessage(playerid, COLOR_GRAD2,"Du Kannst dir das Fahrzeug am roten Checkpoint abholen.");
TogglePlayerControllable(playerid,1);
ForAllPlayers(i){
if(IsPlayerConnected(i)){
SetVehicleParamsForPlayer(GangAutoKaufliste[GangAutoSpectating[playerid]][GACarid],i,0,0);
}}
GangAutoSpectating[playerid] = -1;
RemovePlayerFromVehicle(playerid);
break;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du besichtigst kein Gang Auto !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist kein Leader !");
return 1;
}
return 1;
}
Danke im vorraus.