Hey
Das Car wird erstellt aber nicht gespeichert.
if(strcmp("/buygangcar", cmd, true) == 0)
{
if(PlayerInfo[playerid][pLeader] != -1 || PlayerInfo[playerid][pRank] == 12)
{
new Farbe,
GangCars = 0;
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 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][pMember]][tKasse])
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Es ist nicht mehr genug Geld in der Teamkasse !");
return 1;
}
else
{
if(PlayerInfo[playerid][pMember] == 1)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pMember] == 2)
{
Farbe = 154;
}
if(PlayerInfo[playerid][pMember] == 3)
{
Farbe = 120;
}
if(PlayerInfo[playerid][pMember] == 4)
{
Farbe = 3;
}
if(PlayerInfo[playerid][pMember] == 5)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pMember] == 6)
{
Farbe = 8;
}
if(PlayerInfo[playerid][pMember] == 7)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pMember] == 8)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pMember] == 9)
{
Farbe = 61;
}
if(PlayerInfo[playerid][pMember] == 10)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pMember] == 11)
{
Farbe = 1;
}
if(PlayerInfo[playerid][pMember] == 12)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pMember] == 13)
{
Farbe = 1;
}
if(PlayerInfo[playerid][pMember] == 14)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pMember] == 15)
{
Farbe = 0;
}
if(PlayerInfo[playerid][pMember] == 16)
{
Farbe = -1;
}
if(PlayerInfo[playerid][pMember] == 17)
{
Farbe = 152;
}
if(PlayerInfo[playerid][pMember] == 18)
{
Farbe = 93;
}
if(PlayerInfo[playerid][pMember] == 19)
{
Farbe = 86;
}
if(PlayerInfo[playerid][pMember] == 20)
{
Farbe = 85;
}
if(PlayerInfo[playerid][pMember] == 21)
{
Farbe = 66;
}
if(PlayerInfo[playerid][pMember] == 22)
{
Farbe = 79;
}
if(PlayerInfo[playerid][pMember] == 23)
{
Farbe = 3;
}
if(PlayerInfo[playerid][pMember] == 24)
{
Farbe = 6;
}
if(PlayerInfo[playerid][pMember] == 25)
{
Farbe = 104;
}
if(PlayerInfo[playerid][pMember] == 26)
{
Farbe = 123;
}
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(GangAutoInfo[h][cOwner] == PlayerInfo[playerid][pMember])
{
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][pMember];
GangAutoInfo[h][cID] = -1;
GangAutoInfo[h][cTyp] = GangAutoKaufliste[GangAutoSpectating[playerid]][GAModelid];
new Zufall = random(3);
if(Zufall == 0)
{
GangAutoInfo[h][cPosX] = 1981.9377;
GangAutoInfo[h][cPosY] = 1981.9377;
GangAutoInfo[h][cPosZ] = 10.8203;
}
else if(Zufall == 1)
{
GangAutoInfo[h][cPosX] = 1981.2240;
GangAutoInfo[h][cPosY] = 2051.2224;
GangAutoInfo[h][cPosZ] = 10.8203;
}
else if(Zufall == 2)
{
GangAutoInfo[h][cPosX] = 1980.0446;
GangAutoInfo[h][cPosY] = 2044.4808;
GangAutoInfo[h][cPosZ] = 10.8203;
}
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][pMember]][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,2229.0725,1811.6196,10.4595,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;
}
LoadGangautos:
else
{
new string[128];
for(new i = 0; i < sizeof(GangAutoInfo); i++)
{
format(string, sizeof(string),"SELECT * FROM `gangautos` WHERE `SlotID` = '%d'", i);
self_mysql_query(string);
mysql_store_result(MySQLConnection);
if(mysql_num_rows(MySQLConnection) != 0)
{
mysql_fetch_row_format(string);
new val[ 256 ];
self_mysql_get_field("CarID", val); GangAutoInfo[i][cID] = strval( val );
self_mysql_get_field("OwnerID", val); GangAutoInfo[i][cOwner] = strval( val );
self_mysql_get_field("TypID", val); GangAutoInfo[i][cTyp] = strval( val );
self_mysql_get_field("PosX", val); GangAutoInfo[i][cPosX] = floatstr( val );
self_mysql_get_field("PosY", val); GangAutoInfo[i][cPosY] = floatstr( val );
self_mysql_get_field("PosZ", val); GangAutoInfo[i][cPosZ] = floatstr( val );
self_mysql_get_field("Rotation", val); GangAutoInfo[i][cRot] = floatstr( val );
self_mysql_get_field("Farbe1", val); GangAutoInfo[i][cColor1] = strval( val );
self_mysql_get_field("Farbe2", val); GangAutoInfo[i][cColor2] = strval( val );
self_mysql_get_field("Status", val); GangAutoInfo[i][cStatus] = strval( val );
self_mysql_get_field("Tank", val); GangAutoInfo[i][cTank] = strval( val );
self_mysql_get_field("ReSpawnTime", val); GangAutoInfo[i][cReSpawnTime] = strval( val );
//self_mysql_get_field("StandTime", val); GangAutoInfo[i][cStandTime] = strval( val );
}
else
{
GangAutoInfo[i][cID] = -1;
GangAutoInfo[i][cOwner] = -1;
GangAutoInfo[i][cTyp] = -1;
GangAutoInfo[i][cPosX] = 0;
GangAutoInfo[i][cPosY] = 0;
GangAutoInfo[i][cPosZ] = 0;
GangAutoInfo[i][cRot] = 0;
GangAutoInfo[i][cColor1] = -1;
GangAutoInfo[i][cColor2] = -1;
GangAutoInfo[i][cStatus] = -1;
GangAutoInfo[i][cTank] = 50;
GangAutoInfo[i][cReSpawnTime] = 1800;
GangAutoInfo[i][cStandTime] = 0;
}
mysql_free_result(MySQLConnection);
if(GangAutoInfo[i][cID] == 65535)
{
GangAutoInfo[i][cID] = -1;
}
}
}
return 1;
}
Save Gangcar:
else
{
new string[128];
for(new i = 0; i < sizeof(GangAutoInfo); i++)
{
if(TankSave == 1)
{
if(GangAutoInfo[i][cID] != -1)
{
GangAutoInfo[i][cTank] = Gas[GangAutoInfo[i][cID]];
}
}
format(string, sizeof(string), "SELECT * FROM `gangautos` WHERE `SlotID` = '%d'", i);
self_mysql_query(string);
mysql_store_result(MySQLConnection);
if(mysql_num_rows(MySQLConnection) == 0)
{
format(string, sizeof(string), "INSERT INTO `gangautos` (`SlotID`) VALUES ('%d')", i);
self_mysql_query(string);
}
mysql_free_result(MySQLConnection);
new var[256];
format(var, sizeof(var), "UPDATE `gangautos` SET `CarID`='%d', `OwnerID`='%d', `TypID`='%d', `PosX`='%.1f', `PosY`='%.1f', `PosZ`='%.1f', `Rotation`='%.1f', `Farbe1`='%d', `Farbe2`='%d', `Status`='%d', `Tank`='%d', `ReSpawnTime`='%d' WHERE `SlotID`='%d'",
GangAutoInfo[i][cID],
GangAutoInfo[i][cOwner],
GangAutoInfo[i][cTyp],
GangAutoInfo[i][cPosX],
GangAutoInfo[i][cPosY],
GangAutoInfo[i][cPosZ],
GangAutoInfo[i][cRot],
GangAutoInfo[i][cColor1],
GangAutoInfo[i][cColor2],
GangAutoInfo[i][cStatus],
GangAutoInfo[i][cTank],
GangAutoInfo[i][cReSpawnTime],
//GangAutoInfo[i][cStandTime],
i);
self_mysql_query(var);
}
print("GangAutos Geladen");
}
return 1;
}
public CreateGangAutos()
{
for(new h = 0; h < sizeof(GangAutoInfo); h++){
if(GangAutoInfo[h][cTyp] != -1){
if(GangAutoInfo[h][cStatus] == 0){
GangAutoInfo[h][cID] = CreateVehicle(GangAutoInfo[h][cTyp],GangAutoInfo[h][cPosX],GangAutoInfo[h][cPosY],GangAutoInfo[h][cPosZ],GangAutoInfo[h][cRot],GangAutoInfo[h][cColor1],GangAutoInfo[h][cColor2],GangAutoInfo[h][cReSpawnTime]);
Gas[GangAutoInfo[h][cID]] = GangAutoInfo[h][cTank];
new string[50];
format(string, sizeof(string), "{FFFF00}ir-{21DD00}%d", GangAutoInfo[h][cID]);
SetVehicleNumberPlate(GangAutoInfo[h][cID],string);
}}}
return 1;
}