Код:
if(dialogid == DIALOGID+3)// DealerShip
{
new model = DSModele[IDDS[playerid]][1];
new pret = DSModele[IDDS[playerid]][2];
if(response)
{
SetPlayerPos(playerid,2125.5842,-1151.8530,23.9997);
DestroyVehicle(IDMasina[playerid]);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
SetCameraBehindPlayer(playerid);
if(GetPlayerMoney(playerid) < DSModele[IDDS[playerid]][2]) return SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}ServeR: Nu ai suficienti bani pentru a cumpara aceasta masina!");
if(vehSlots[model] <= 0) return SendClientMessage(playerid, COLOR_WHITE, "{33CCFF}ServeR: Nu sunt suficiente modele in stok!");
GivePlayerMoney(playerid,- DSModele[IDDS[playerid]][2]);
format(string,sizeof(string),"{33CCFF}ServeR: Ai cumparat un %s pentru %d.",vehName[DSModele[IDDS[playerid]][1]-400],DSModele[IDDS[playerid]][2]);
SendClientMessage(playerid,COLOR_WHITE,string);
created++;
format(CarInfo[created][cLicense], 32 ,"DealerShip");
CarInfo[created][cOwned] = 1; CarInfo[created][cModel] = model; CarInfo[created][cColorOne] = 3; CarInfo[created][cColorTwo] = 3;
CarInfo[created][cLocationx] = 1649.6346; CarInfo[created][cLocationy] = -1080.1403; CarInfo[created][cLocationz] = 23.5273; CarInfo[created][cAngle] = 88.5238;
CarInfo[created][cValue] = pret; CarInfo[created][cLock] = 0; CarInfo[created][paintjob] = -1; LoadComponents(created);
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[created][cOwner], sendername, 0, strlen(sendername), 999);
SaveCarCoords();
new MasinaPers = CreateVehicle(CarInfo[created][cModel],CarInfo[created][cLocationx],CarInfo[created][cLocationy],CarInfo[created][cLocationz],CarInfo[created][cAngle],CarInfo[created][cColorOne],CarInfo[created][cColorTwo],-1);
SetVehicleNumberPlate(MasinaPers,CarInfo[created][cLicense]);
if(PlayerInfo[playerid][pPcarkey] == 0) { PlayerInfo[playerid][pPcarkey] = created; }
else if(PlayerInfo[playerid][pPcarkey2] == 0) { PlayerInfo[playerid][pPcarkey2] = created; }
else if(PlayerInfo[playerid][pPcarkey3] == 0) { PlayerInfo[playerid][pPcarkey3] = created; }
vehSlots[model] --;
SaveVehModels();
SavePlayerData(playerid);
}
else
{
SetPlayerPos(playerid,2125.5842,-1151.8530,23.9997);
DestroyVehicle(IDMasina[playerid]);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
SetCameraBehindPlayer(playerid);
SendClientMessage(playerid,COLOR_YELLOW,"{33CCFF}ServeR: Ai parasit Magazinul!");
}
}