Hallo Community.
Ich habe ein gangautohaus gescripter und habe nun ein problem. wen ich mich in ein Gangauto setze was zum verkaufen steht wird dort alles angezeigt "Willst du dieses gangauto kaufen" das ist alles richtig nur wen ich auf das button Ja klicke spawne ich nicht mit dem auto. und wen ich Nein klicke werde ich nicht aus dem auto geworfen sondern bleibe einfach gefrezzt weis jemand was das problem ist?
Hier Code:
forward FRAC_OnPlayerStateChange(playerid, newstate, oldstate);
public FRAC_OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate==PLAYER_STATE_DRIVER)
{
new Carid1 = GetPlayerVehicleID(playerid);
for(new fbl;fbl<sizeof(FactionBuylist);fbl++)
{
if(Carid1 == FactionBuylist[fbl][fbCarid])
{
if(IsAllowedFactionToBuy(GetPlayerLeader(playerid)))
{
TogglePlayerControllable(playerid,false);
new fblText[256];
format(fblText,sizeof(fblText),"{FFFFFF}Willst du das Fahrzeug für deine Fraktion kaufen?\n\n{F3FF02}Fahrzeug: %s\nPreis: $%d\n\n{FFFFFF}Drücke auf den Button 'Ja' um das Fahrzeug zukaufen \n Drücke auf den Button 'Nein' um es Abbzubrechen.",fCarName[FactionBuylist[fbl][fbVehid]-400],FactionBuylist[fbl][fbPrice]);
ShowPlayerDialog(playerid,DIALOG_FCAR,DIALOG_STYLE_MSGBOX,"{FFFFFF}Fraktionsautohaus:",fblText,"Nein","Ja");
}else{
SendClientMessage(playerid,FACTION_COL_GREY,"Du kannst keine Gangautos kaufen!");
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
}break;
}
}
for(new fc;fc<sizeof(FactionCars);fc++){
if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
if(FactionCars[fc][fCarid] == GetPlayerVehicleID(playerid)){
for(new f;f<5;f++){
if(GetPlayerAdminLevel(playerid) >= NEEDED_ADMINLEVEL || GetPlayerFaction(playerid) == FactionCars[fc][fFaction][f])
return true;
}
SendClientMessage(playerid,FACTION_COL_GREY,"Du bestitzt für dieses Fahrzeug keine Schlüssel, du verlässt das Fahrzeug.");
RemovePlayerFromVehicle(playerid);
return true;
}
}
}
}return 1;
}
forward FRAC_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
public FRAC_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
if(dialogid == DIALOG_FCAR){
if(response){
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
TogglePlayerControllable(playerid,true);
}
if(!response){
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
if(IsAllowedFactionToBuy(GetPlayerLeader(playerid))){
if(GetFactioncarsOfFaction(GetPlayerLeader(playerid)) < MAX_BUY){
new Carid1 = GetPlayerVehicleID(playerid);
for(new fbl;fbl<sizeof(FactionBuylist);fbl++){
if(Carid1 == FactionBuylist[fbl][fbCarid]){
if(GetPlayerMoney(playerid) >= FactionBuylist[fbl][fbPrice]){
//if(CallRemoteFunction("Script_GetPlayerMoney","i",playerid) >= FactionBuylist[fbl][fbPrice]){
for(new fc;fc<sizeof(FactionCars);fc++){
if(FactionCars[fc][fVehid] < 400 || FactionCars[fc][fVehid] > 611){
FactionCars[fc][fVehid] = FactionBuylist[fbl][fbVehid];
FactionCars[fc][fPos][0] = FactionBuySpawn[0];
FactionCars[fc][fPos][1] = FactionBuySpawn[1];
FactionCars[fc][fPos][2] = FactionBuySpawn[2];
FactionCars[fc][fPos][3] = FactionBuySpawn[3];
new Color[2];
GetDefaultCarColorOfFaction(GetPlayerLeader(playerid),Color[0],Color[1]);
FactionCars[fc][fCol][0] = Color[0];
FactionCars[fc][fCol][1] = Color[1];
FactionCars[fc][fPrice] = FactionBuylist[fbl][fbPrice];
for(new slot;slot<14;slot++)
FactionCars[fc][fTuning][slot] = 0;
FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
print(">>> Nach dem Autoerstellen!");
#if defined FACTION_CARS_LOCKABLE
fLockCar(FactionCars[fc][fCarid]);
FactionCars[fc][fLock] = true;
#endif
for(new f;f<5;f++)
{
FactionCars[fc][fFaction][f] = -255;
}
FactionCars[fc][fFaction][0] = GetPlayerLeader(playerid);
PutPlayerInVehicle(playerid,FactionCars[fc][fCarid],0);
GivePlayerMoney(playerid, -FactionBuylist[fbl][fbPrice]);
//CallRemoteFunction("Script_SetPlayerMoney","id",playerid,(CallRemoteFunction("Script_GetPlayerMoney","i",playerid)-FactionBuylist[fbl][fbPrice]));
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
TogglePlayerControllable(playerid,true);
SendClientMessage(playerid,FACTION_COL_YELLOW,"Du hast erfolgreich das Fahrzeug gekauft.");
SendClientMessage(playerid,FACTION_COL_YELLOW,"Das Fahrzeug kannst du mit /fpark parken!");
return 1;
}
}SendClientMessage(playerid,FACTION_COL_GREY,"Die maximale Anzahl von Fraktionsfahrzeugen ist bereits erreicht.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Dein Geld reicht nicht aus!");
break;
}
}
}else SendClientMessage(playerid,FACTION_COL_GREY,"Deine Fraktion hat das Limit von Fahrzeugen bereits erreicht.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Du kannst keine Gangautos kaufen!");
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.5,pPos[1]+2.5,pPos[2]);
TogglePlayerControllable(playerid,true);
}
}return 1;
}return 0;
}