Hab ein autohaus gescriptet wo die autos halt parken und wenn man einsteigt diese kaufen kann. Nun gibt es mehrere Autohäuser und hab soweit alles funktionierend. Nur eine Stelle bereitet mir echt Probleme. Wenn man ein Auto z.B. in Los Santos kauft wird es halt an die Stelle des ersten Autohauses von mir In LV geportet. Hab jetzt so einiges versucht unten der Code hoffe ihr könnt mir Helfen.
if(dialogid == Dialog0)
{
new autozahl = 0;
if(response == 1)
{
if(PlayerInfo[playerid][psKey] > 0)
{
SendClientMessage(playerid, rot,"Du besitzt schon ein Auto !");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(GetPlayerMoney(playerid) >= pspreis[playerid])
{
if(psautohaus[autozahl] <= psautohaus[35]) //LV Limos
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"2175.2119,1391.9048,10.4454,90.0187, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), 2175.2119,1391.9048,10.4454,90.0187,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, 2199.4885,1393.2869,10.8203);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[36] && psautohaus[autozahl] <= psautohaus[49] ) //Sportwagen
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"-1636.4858,1207.8816,6.7321,224.7615, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), -1636.4858,1207.8816,6.7321,224.7615,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, -1641.5842,1203.4105,7.2471);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[50] && psautohaus[autozahl] <= psautohaus[63] ) //wang cars
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"-1988.2111,303.7925,34.9628,269.2296, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), -1988.2111,303.7925,34.9628,269.2296,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, -1967.1671,293.7437,35.2752);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[64] && psautohaus[autozahl] <= psautohaus[72] ) //bikes
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"2127.1387,-1150.8926,23.7617,322.1908, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), 2127.1387,-1150.8926,23.7617,322.1908,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, 2131.4353,-1149.5685,24.2485);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
}
{
new autozahl = 0;
if(response == 1)
{
if(PlayerInfo[playerid][psKey] > 0)
{
SendClientMessage(playerid, rot,"Du besitzt schon ein Auto !");
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(GetPlayerMoney(playerid) >= pspreis[playerid])
{
if(psautohaus[autozahl] <= psautohaus[35]) //LV Limos
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"2175.2119,1391.9048,10.4454,90.0187, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), 2175.2119,1391.9048,10.4454,90.0187,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, 2199.4885,1393.2869,10.8203);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[36] && psautohaus[autozahl] <= psautohaus[49] ) //Sportwagen
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"-1636.4858,1207.8816,6.7321,224.7615, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), -1636.4858,1207.8816,6.7321,224.7615,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, -1641.5842,1203.4105,7.2471);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[50] && psautohaus[autozahl] <= psautohaus[63] ) //wang cars
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"-1988.2111,303.7925,34.9628,269.2296, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), -1988.2111,303.7925,34.9628,269.2296,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, -1967.1671,293.7437,35.2752);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
if(psautohaus[autozahl] >= psautohaus[64] && psautohaus[autozahl] <= psautohaus[72] ) //bikes
{
GivePlayerMoney(playerid, -pspreis[playerid]);
PlayerInfo[playerid][psPreis] = pspreis[playerid];
format(string, sizeof(string),"2127.1387,-1150.8926,23.7617,322.1908, 0, 0, %d, %d",GetVehicleModel(GetPlayerVehicleID(playerid)),pspreis[playerid]);
SaveVehicles(string, playerid);
PlayerInfo[playerid][psKey] = CreateVehicle(GetVehicleModel(GetPlayerVehicleID(playerid)), 2127.1387,-1150.8926,23.7617,322.1908,0,0,-1);
GetPlayerName(playerid, name, sizeof(name));
format(sts, sizeof(sts),"%s",name);
SetVehicleNumberPlate(PlayerInfo[playerid][psKey], sts);
SetVehicleToRespawn(PlayerInfo[playerid][psKey]);
SetPlayerPos(playerid, 2131.4353,-1149.5685,24.2485);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
format(str, sizeof(str),"Auto erfolgreich für %d$ gekauft !",pspreis[playerid]);
SendClientMessage(playerid, blau, str);
return 1;
}
}
else
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, rot,"Du besitzt zu wenig Geld für dieses Auto !");
return 1;
}
}
if(response == 0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
}
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, rot,"Du besitzt zu wenig Geld für dieses Auto !");
return 1;
}
}
if(response == 0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
}