Guten Tag,
Ich bin grade an einem Autohaus system dran und habe 2 Autohäuser Spawns gemacht und es buggt jetzt hir der code:
enums:
enum ahSpawn
{
Float:pos_x,
Float:pos_y,
Float:pos_z,
Float:z_angle,
};
new Autospawns[2][ahSpawn] = {
{739.7457,-1343.8668,13.2828,270.2592},
{-1640.8845,1198.1356,6.9160,268.8890}
};
{
Float:pos_x,
Float:pos_y,
Float:pos_z,
Float:z_angle,
};
new Autospawns[2][ahSpawn] = {
{739.7457,-1343.8668,13.2828,270.2592},
{-1640.8845,1198.1356,6.9160,268.8890}
};
enum autoverkaufInfo
{
Autohaus,
FahrzeugName[128],
ModelID,
CarPreis,
Float:AUTOPoS_X,
Float:AUTOPoS_Y,
Float:AUTOPoS_Z,
Float:AUTOPoS_A,
VEHID
}
new autokauf[6][autoverkaufInfo] = {
{0,"Sultan",560,60000,766.0,-1333.0,13.3,211.1,-1},
{1,"SUPER GT",506,60000,-1651.6337,1208.2534,20.7991,305.1250,-1},
{1,"Cheetah",415,60000,-1677.3573,1207.8119,13.4082,208.2588,-1},
{1,"Bullet",541,60000,-1651.3844,1210.3466,6.9028,281.3334,-1},
{1,"Blista Compact",496,60000,-1668.6449,1207.0374,7.0149,309.5804,-1},
{1,"Buffalo",402,60000,-1663.6716,1215.3939,7.0511,274.0793,-1}
};
{
Autohaus,
FahrzeugName[128],
ModelID,
CarPreis,
Float:AUTOPoS_X,
Float:AUTOPoS_Y,
Float:AUTOPoS_Z,
Float:AUTOPoS_A,
VEHID
}
new autokauf[6][autoverkaufInfo] = {
{0,"Sultan",560,60000,766.0,-1333.0,13.3,211.1,-1},
{1,"SUPER GT",506,60000,-1651.6337,1208.2534,20.7991,305.1250,-1},
{1,"Cheetah",415,60000,-1677.3573,1207.8119,13.4082,208.2588,-1},
{1,"Bullet",541,60000,-1651.3844,1210.3466,6.9028,281.3334,-1},
{1,"Blista Compact",496,60000,-1668.6449,1207.0374,7.0149,309.5804,-1},
{1,"Buffalo",402,60000,-1663.6716,1215.3939,7.0511,274.0793,-1}
};
enum sAutoInfo
{
ModelID,
Carid,
Float:AUTOPoS_X,
Float:AUTOPoS_Y,
Float:AUTOPoS_Z,
Float:AUTOPoS_A,
Farbe1,
Farbe2,
}
new pAutoInfo[MAX_PLAYERS][sAutoInfo];
{
ModelID,
Carid,
Float:AUTOPoS_X,
Float:AUTOPoS_Y,
Float:AUTOPoS_Z,
Float:AUTOPoS_A,
Farbe1,
Farbe2,
}
new pAutoInfo[MAX_PLAYERS][sAutoInfo];
Hir OnPlayerStateChange:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<sizeof(autokauf); i++)
{
if(GetPlayerVehicleID(playerid)==autokauf[i][VEHID])
{
new string[128];
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid, Gelb, "~*~ Autohaus ~*~");
format(string,128,"Name: %s",autokauf[i][FahrzeugName]);
SendClientMessage(playerid, Gelb, string);
format(string,128,"Preis: $%i",autokauf[i][CarPreis]);
SendClientMessage(playerid, Gelb, string);
format(string,128,"Reparaturkosten: $0");
SendClientMessage(playerid, Gelb, string);
SendClientMessage(playerid, Gruen, "Dieses Fahrzeug ist zu verkaufen. Um es zu kaufen, benutze: /buycar");
SendClientMessage(playerid, Gruen, "Um das Fahrzeug zu verlassen, benutze: /exitcar");
}
}
}
return 1;
}
{
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<sizeof(autokauf); i++)
{
if(GetPlayerVehicleID(playerid)==autokauf[i][VEHID])
{
new string[128];
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid, Gelb, "~*~ Autohaus ~*~");
format(string,128,"Name: %s",autokauf[i][FahrzeugName]);
SendClientMessage(playerid, Gelb, string);
format(string,128,"Preis: $%i",autokauf[i][CarPreis]);
SendClientMessage(playerid, Gelb, string);
format(string,128,"Reparaturkosten: $0");
SendClientMessage(playerid, Gelb, string);
SendClientMessage(playerid, Gruen, "Dieses Fahrzeug ist zu verkaufen. Um es zu kaufen, benutze: /buycar");
SendClientMessage(playerid, Gruen, "Um das Fahrzeug zu verlassen, benutze: /exitcar");
}
}
}
return 1;
}
Hir der befehl buycar:
ocmd:buycar(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
for(new i=0; i<sizeof(autokauf); i++)
{
new preis =autokauf[i][CarPreis];
GivePlayerMoney(playerid,preis);
new autohaus=autokauf[i][Autohaus];
pAutoInfo[playerid][AUTOPoS_X] = Autospawns[autohaus][pos_x];
pAutoInfo[playerid][AUTOPoS_Y] = Autospawns[autohaus][pos_y];
pAutoInfo[playerid][AUTOPoS_Z] = Autospawns[autohaus][pos_z];
pAutoInfo[playerid][AUTOPoS_A] = Autospawns[autohaus][z_angle];
pAutoInfo[playerid][ModelID] = autokauf[i][ModelID];
pAutoInfo[playerid][Carid] = AddStaticVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][AUTOPoS_X],pAutoInfo[playerid][AUTOPoS_Y],pAutoInfo[playerid][AUTOPoS_Z],pAutoInfo[playerid][AUTOPoS_A],-1,-1);
SendClientMessage(playerid, Gruen, "Mit /carlock kannst du dein Fahrzeug für andere Leute freigeben oder abschließen.");
SendClientMessage(playerid, Gelb, "Dein Auto steht am Ausgabepunkt bereit! Viel Spaß beim Fahren! Und Beachte die StVo!");
TogglePlayerControllable(playerid,1);
RemovePlayerFromVehicle(playerid);
}
}
else{SendClientMessage(playerid,Rot,"Du bist in keinem Autohaus Auto!");}
return 1;
}
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
for(new i=0; i<sizeof(autokauf); i++)
{
new preis =autokauf[i][CarPreis];
GivePlayerMoney(playerid,preis);
new autohaus=autokauf[i][Autohaus];
pAutoInfo[playerid][AUTOPoS_X] = Autospawns[autohaus][pos_x];
pAutoInfo[playerid][AUTOPoS_Y] = Autospawns[autohaus][pos_y];
pAutoInfo[playerid][AUTOPoS_Z] = Autospawns[autohaus][pos_z];
pAutoInfo[playerid][AUTOPoS_A] = Autospawns[autohaus][z_angle];
pAutoInfo[playerid][ModelID] = autokauf[i][ModelID];
pAutoInfo[playerid][Carid] = AddStaticVehicle(pAutoInfo[playerid][ModelID],pAutoInfo[playerid][AUTOPoS_X],pAutoInfo[playerid][AUTOPoS_Y],pAutoInfo[playerid][AUTOPoS_Z],pAutoInfo[playerid][AUTOPoS_A],-1,-1);
SendClientMessage(playerid, Gruen, "Mit /carlock kannst du dein Fahrzeug für andere Leute freigeben oder abschließen.");
SendClientMessage(playerid, Gelb, "Dein Auto steht am Ausgabepunkt bereit! Viel Spaß beim Fahren! Und Beachte die StVo!");
TogglePlayerControllable(playerid,1);
RemovePlayerFromVehicle(playerid);
}
}
else{SendClientMessage(playerid,Rot,"Du bist in keinem Autohaus Auto!");}
return 1;
}
wenn ich /buycar eingebe un ich bin im 2 autohaus dann kauf ich alle oO cars die es in diesem autohaus gibt oO.
Ich dank schon mal im vorraus.
mfg. Fabi.StaR