Wenn ich mir das Auto kaufe, spawnt nicht nur eins sondern ganze Zeit welche und dann stürzt der Server ab, woran liegt das oder woran kann es liegen?
Code:
if(dialogid == DIALOG_GANGAUTOHAUS)
{
if(response)
{
new Farbe,
GangCars = 0;
if(PlayerInfo[playerid][pTeam] == 1 || PlayerInfo[playerid][pTeam] == 3 || PlayerInfo[playerid][pTeam] == 4 || PlayerInfo[playerid][pTeam] == 7 || PlayerInfo[playerid][pTeam] == 9 || PlayerInfo[playerid][pTeam] == 11 || PlayerInfo[playerid][pTeam] == 12 || PlayerInfo[playerid][pTeam] == 13 || PlayerInfo[playerid][pTeam] == 14 || PlayerInfo[playerid][pTeam] == 16)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Deine Fraktion ist nicht Berechtigt Gangautos zu Kaufen.");
return 1;
}
new GangAutoPreis = GangAutoKaufliste[listitem][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] == 2)
{
Farbe = 154;
}
if(PlayerInfo[playerid][pTeam] == 5)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pTeam] == 6)
{
Farbe = 8;
}
if(PlayerInfo[playerid][pTeam] == 8)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 10)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pTeam] == 15)
{
Farbe = 0;
}
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 = 43;
}
if(PlayerInfo[playerid][pTeam] == 24)
{
Farbe = 6;
}
if(PlayerInfo[playerid][pTeam] == 25)
{
Farbe = 0;
}
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 kann nicht mehr als 25 Gangautos besitzen!");
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[listitem][GAModelid];
if(PlayerInfo[playerid][pTeam] == 2)
{
GangAutoInfo[h][cPosX] = -364;
GangAutoInfo[h][cPosY] = 1552;
GangAutoInfo[h][cPosZ] = 75;
}
else if(PlayerInfo[playerid][pTeam] == 5)
{
GangAutoInfo[h][cPosX] = 600;
GangAutoInfo[h][cPosY] = -1510;
GangAutoInfo[h][cPosZ] = 15;
}
else if(PlayerInfo[playerid][pTeam] == 6)
{
GangAutoInfo[h][cPosX] = 2572;
GangAutoInfo[h][cPosY] = 1763;
GangAutoInfo[h][cPosZ] = 10;
}
else if(PlayerInfo[playerid][pTeam] == 8)
{
GangAutoInfo[h][cPosX] = 258;
GangAutoInfo[h][cPosY] = -1166;
GangAutoInfo[h][cPosZ] = 79;
}
else if(PlayerInfo[playerid][pTeam] == 10)
{
GangAutoInfo[h][cPosX] = 2167;
GangAutoInfo[h][cPosY] = -1799;
GangAutoInfo[h][cPosZ] = 13;
}
else if(PlayerInfo[playerid][pTeam] == 15)
{
GangAutoInfo[h][cPosX] = 1223;
GangAutoInfo[h][cPosY] = -1668;
GangAutoInfo[h][cPosZ] = 11;
}
else if(PlayerInfo[playerid][pTeam] == 17)
{
GangAutoInfo[h][cPosX] = -2558;
GangAutoInfo[h][cPosY] = 859;
GangAutoInfo[h][cPosZ] = 57;
}
else if(PlayerInfo[playerid][pTeam] == 18)
{
GangAutoInfo[h][cPosX] = 2778;
GangAutoInfo[h][cPosY] = -2019;
GangAutoInfo[h][cPosZ] = 13;
}
else if(PlayerInfo[playerid][pTeam] == 19)
{
GangAutoInfo[h][cPosX] = 2430;
GangAutoInfo[h][cPosY] = -1639;
GangAutoInfo[h][cPosZ] = 13;
}
else if(PlayerInfo[playerid][pTeam] == 20)
{
GangAutoInfo[h][cPosX] = 1917;
GangAutoInfo[h][cPosY] = -1085;
GangAutoInfo[h][cPosZ] = 24;
}
else if(PlayerInfo[playerid][pTeam] == 21)
{
GangAutoInfo[h][cPosX] = 2062;
GangAutoInfo[h][cPosY] = 2512;
GangAutoInfo[h][cPosZ] = 10;
}
else if(PlayerInfo[playerid][pTeam] == 22)
{
GangAutoInfo[h][cPosX] = -2641;
GangAutoInfo[h][cPosY] = -255;
GangAutoInfo[h][cPosZ] = 6;
}
else if(PlayerInfo[playerid][pTeam] == 23)
{
GangAutoInfo[h][cPosX] = 727;
GangAutoInfo[h][cPosY] = -1243;
GangAutoInfo[h][cPosZ] = 13;
}
else if(PlayerInfo[playerid][pTeam] == 24)
{
GangAutoInfo[h][cPosX] = 2409;
GangAutoInfo[h][cPosY] = -1385;
GangAutoInfo[h][cPosZ] = 24;
}
else if(PlayerInfo[playerid][pTeam] == 25)
{
GangAutoInfo[h][cPosX] = 2693;
GangAutoInfo[h][cPosY] = -2226;
GangAutoInfo[h][cPosZ] = 13;
}
else if(PlayerInfo[playerid][pTeam] == 26)
{
GangAutoInfo[h][cPosX] = 2113;
GangAutoInfo[h][cPosY] = 1622;
GangAutoInfo[h][cPosZ] = 10;
}
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), "Fahrzeug erfolgreich gekauft. Es wurden $%s von der Gangkasse abgezogen.", GetPoint(GangAutoPreis));
ShowPlayerDialog(playerid,DIALOG_GANGAUTOHAUS2,DIALOG_STYLE_MSGBOX,"Gangautohaus",string,"Ok", "");
}
}
}
}
return 1;
}