10.11.2012, 08:13
ok, so when i enter a dealership car a dialog pops up if i wanna buy the car i select yes and the dialog just disappears and im stuck frozen
[pawn] if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;
if(GetCarDealershipVehicleId(newcar) != -1)
{
new string[57 + 20 + 4];
format(string, sizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d.", GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);
ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYL E_MSGBOX,"Warning:",string,"Buy","Cancel");
TogglePlayerControllable(playerid, false);
return 1;
}[pawn]
[pawn] if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;
if(GetCarDealershipVehicleId(newcar) != -1)
{
new string[57 + 20 + 4];
format(string, sizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d.", GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);
ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYL E_MSGBOX,"Warning:",string,"Buy","Cancel");
TogglePlayerControllable(playerid, false);
return 1;
}[pawn]
pawn Код:
else if(dialogid == DIALOG_CDBUY)
{
// Account Eating Bug Fix
if(!IsPlayerInAnyVehicle(playerid))
{
TogglePlayerControllable(playerid, 1);
SendClientMessageEx(playerid,COLOR_GRAD2,"You need to be in the vehicle you wish to purchase.");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
new v = GetCarDealershipVehicleId(vehicleid);
new d = GetCarDealershipId(vehicleid);
if(response)
{
if(CarDealershipInfo[d][cdVehicleSpawn][0] == 0.0 && CarDealershipInfo[d][cdVehicleSpawn][1] == 0.0 && CarDealershipInfo[d][cdVehicleSpawn][2] == 0.0)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: The owner of this Car Dealership hasn't set the purchased vehicles spawn point.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(IsVIPModel(vehicleid) && (PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pTempVIP] > 0))
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Only VIP's can own that type of vehicles.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
new playervehicleid = GetPlayerFreeVehicleId(playerid);
new carsamount = GetPlayerVehicleCount(playerid);
if((PlayerInfo[playerid][pDonateRank] == 0 || PlayerInfo[playerid][pTempVIP] > 0) && carsamount >= 2)
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 1 && carsamount >= 3)
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, Bronze can only own 1 extra car.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 2 && carsamount >= 4)
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, Silver VIP can only own 2 extra cars.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 3 && carsamount >= 5)
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, Gold VIP can only own 3 extra cars.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(PlayerInfo[playerid][pDonateRank] == 4 && carsamount >= 10)//car amount limites
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars, Gold VIP can only own 3 extra cars.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
if(playervehicleid == -1)
{
SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You can't have more cars.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
new randcolor1 = Random(0, 126);
new randcolor2 = Random(0, 126);
SetPlayerPos(playerid, CarDealershipInfo[d][cdVehicleSpawn][0], CarDealershipInfo[d][cdVehicleSpawn][1], CarDealershipInfo[d][cdVehicleSpawn][2]+2);
TogglePlayerControllable(playerid, 1);
new cost;
if(PlayerInfo[playerid][pDonateRank] < 1)
{
cost = CarDealershipInfo[d][cdVehicleCost][v];
if(GetPVarInt(playerid, "Cash") < CarDealershipInfo[d][cdVehicleCost][v])
{
SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: You don't have enough money to buy this.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
return 1;
}
format(string, sizeof(string), " Thank you for buying at %s.", CarDealershipInfo[d][cdMessage]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")-CarDealershipInfo[d][cdVehicleCost][v]);
CarDealershipInfo[d][cdTill] += ( CarDealershipInfo[d][cdVehicleCost][v] * 40 ) / ( 100 );
}
else
{
cost = ( CarDealershipInfo[d][cdVehicleCost][v] * 80 ) / ( 100 );
if(GetPVarInt(playerid, "Cash") < cost)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "ERROR: You don't have enough money to buy this.");
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
return 1;
}
format(string, sizeof(string), " Thank you for buying at %s.", CarDealershipInfo[d][cdMessage]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash") - cost );
CarDealershipInfo[d][cdTill] += cost;
}
new car = CreatePlayerVehicle(playerid, playervehicleid, CarDealershipInfo[d][cdVehicleModel][v], CarDealershipInfo[d][cdVehicleSpawn][0], CarDealershipInfo[d][cdVehicleSpawn][1], CarDealershipInfo[d][cdVehicleSpawn][2], CarDealershipInfo[d][cdVehicleSpawn][3], randcolor1, randcolor2, cost);
SetTimerEx("PutPlayerInVeh", 2000, 0, "dd", playerid, car);
SavecDealership(d);
}
else
{
RemovePlayerFromVehicle(playerid);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+1.2);
TogglePlayerControllable(playerid, 1);
return 1;
}
}