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}Möchtest du das Fahrzeug deiner Fraktion kaufen?\n\n{F3FF02}Fahrzeugname: %s\nPreis: $%d\n\n{FFFFFF}Um das Fahrzeug zu kaufen benutze den Button 'Ja', um es nicht zu kaufen den Button 'Nein'.",fCarName[FactionBuylist[fbl][fbVehid]-400],FactionBuylist[fbl][fbPrice]);
ShowPlayerDialog(playerid,DIALOG_FACTION_CAR_BUY,DIALOG_STYLE_MSGBOX,"{FFFFFF}Fraktionsautohaus:",fblText,"Nein","Ja");
}else{
SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht brechtigt Fraktionsfahrzeuge zu 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(GetPlayerAdmin(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_FACTION_CAR_BUY){
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(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][fLocked] = 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);
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,"Glückwunsch zum neuen Fahrzeug.");
SendClientMessage(playerid,FACTION_COL_YELLOW,"Bitte vergesse nicht das Fahrzeug mit: '/fpark' umzuparken.");
SendClientMessage(playerid,FACTION_COL_YELLOW,"Das Fahrzeug steht am Ausgabepunkt bereit!");
return 1;
}
}SendClientMessage(playerid,FACTION_COL_GREY,"Die maximale Anzahl von Fraktionsfahrzeugen ist bereits erreicht.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Du hast nicht genügend Geld bei dir!");
break;
}
}
}else SendClientMessage(playerid,FACTION_COL_GREY,"Deine Fraktion hat das Limit von Fahrzeugen bereits erreicht.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht brechtigt Fraktionsfahrzeuge zu 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;
}
Irgendwie öffnet sich beim Einsteigen vom Auto etc. dieser Dialog nicht und ich kann die autos die da stehen einfach fahren..