10.11.2012, 08:37
try it!
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 );
return 1;
}
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);
return 1;
}
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;
}
}
return 0;