29.04.2012, 19:23
(
Последний раз редактировалось imagician; 29.04.2012 в 21:16.
)
Hi guys.
I have a fraction dealership system.
If I click Yes or No in the dialog, I'll freezed - what's the problem?
and
I have a fraction dealership system.
If I click Yes or No in the dialog, I'll freezed - what's the problem?
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate){
if(newstate==PLAYER_STATE_DRIVER){
new Carid = GetPlayerVehicleID(playerid);
for(new fbl;fbl<sizeof(FactionBuylist);fbl++){
if(Carid == 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_RED,"Du bist nicht berechtigt Fraktionsfahrzeuge zu kaufen!");
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
}break;
}
}
}return 1;
}
pawn Код:
public 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.0,pPos[1]+2.0,pPos[2]);
TogglePlayerControllable(playerid,true);
}
if(!response){
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
if(IsAllowedFactionToBuy(GetPlayerLeader(playerid))){
if(GetFactioncarsOfFaction(GetPlayerLeader(playerid)) < MAX_BUY){
new Carid = GetPlayerVehicleID(playerid);
for(new fbl;fbl<sizeof(FactionBuylist);fbl++){
if(Carid == FactionBuylist[fbl][fbCarid]){
if(GetPlayerMoney(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);
#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);
GivePlayerMoney(playerid,-FactionBuylist[fbl][fbPrice]);
TogglePlayerControllable(playerid,true);
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
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 nun am Ausgabepunkt bereit!");
return 1;
}
}
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
TogglePlayerControllable(playerid,true);
SendClientMessage(playerid,FACTION_COL_RED,"Die maximale Anzahl von Fraktionsfahrzeugen ist bereits erreicht.");
}else{
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
TogglePlayerControllable(playerid,true);
SendClientMessage(playerid,FACTION_COL_RED,"Du hast nicht genьgend Geld bei dir!");
}return 1;
}
}
}else{
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
TogglePlayerControllable(playerid,true);
SendClientMessage(playerid,FACTION_COL_RED,"Du hast nicht genьgend Geld bei dir!");
SendClientMessage(playerid,FACTION_COL_RED,"Deine Fraktion hat das Limit von Fahrzeugen bereits erreicht.");
}
}else{
SendClientMessage(playerid,FACTION_COL_RED,"Du bist nicht brechtigt Fraktionsfahrzeuge zu kaufen!");
TogglePlayerControllable(playerid,true);
new Float:pPos[3];
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
SetPlayerPos(playerid,pPos[0]+2.0,pPos[1]+2.0,pPos[2]);
}
}
}return 1;
}return 0;
}