21.01.2013, 17:42
I made COS System. When a player enters the vehicle, the player will freeze and not open my dialog for purchase. I put the dialog without format (string), and then we open the dialog, but when I hit that a player buys a vehicle, nothing happens. I get back into the vehicle, and click Exit, and my Player is ejected out of the vehicle.
Код:
for(new v = 0; v < sizeof(VehicleInfo); v++) { if(GetPlayerVehicleID(playerid) == VehicleInfo[v][vID]) { if (VehicleInfo[v][vOwned] == 0) { new idvozila; new dialog[512]; idvozila = GetPlayerVehicleID(playerid); format(dialog,sizeof(dialog),"Ukoliko zelite kupiti ovo vozilo, prisitnite Kupi,\nukoliko nezelite kupiti ovo vozilo, pritisnite Odustani. Cijena vozila: $%d",VehicleInfo[idvozila][vBuyPrice]); SPD(playerid,DIALOG_COCARBUY,DIALOG_STYLE_MSGBOX,"Kupnja vlastitog vozila",dialog,"Kupi","Odustani"); TogglePlayerControllable(playerid, 0); } } }
Код:
if(dialogid == DIALOG_COCARBUY) { if(response) { for(new v = 0; v < sizeof(VehicleInfo); v++) { new idvozila; new string[256]; new engine, lights, alarm, doors, bonnet, boot, objective; idvozila = VehicleInfo[v][vID]; if(SafeGetPlayerMoney(playerid) < VehicleInfo[idvozila][vBuyPrice]) { SCM(playerid, COLOR_RED,"Nemate dovoljno novca za kupnju ovog vozila"); RemovePlayerFromVehicle(playerid); return 1; } PlayerInfo[playerid][pPcocarkey] = idvozila; TogglePlayerControllable(playerid, 1); format(string, sizeof(string), "Cestitamo! Kupili ste vozilo za $%d. Sad mozete upaliti vozilo(/engine).",VehicleInfo[idvozila][vBuyPrice]); SCM(playerid, COLOR_WHITE, string); vEngine[idvozila] = OFF; GetVehicleParamsEx(idvozila, engine, lights, alarm, doors, bonnet, boot, objective); SetVehicleParamsEx(idvozila, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective); AC_BS_GivePlayerMoney(playerid, -VehicleInfo[idvozila][vBuyPrice]); PlayerInfo[playerid][pNovac] -= VehicleInfo[idvozila][vBuyPrice]; SacuvajIgraca(playerid); } } else { TogglePlayerControllable(playerid, 1); RemovePlayerFromVehicle(playerid); } }