09.08.2011, 16:29
pawn Код:
else if(!strcmp(x_v, "sell",true))
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
return 1;
}
if (!(PlayerToPoint(15.0,playerid,1702.8602,-1469.6306,13.5469)|| PlayerToPoint(15.0,playerid,2362.2329,-2519.3853,3.0000)))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not at a dealership !");
return 1;
}
new vehi = GetPlayerVehicleID(playerid);
if(VehicleInfo[vehi][vOwned] != 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
return 1;
}
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[vehi][vOwner], true) == 0)
{
new PriceS = (CarsPrices[GetVehicleModel(vehi)-400]*20)/100;
new Price = CarsPrices[GetVehicleModel(vehi)-400]-PriceS;
format(string, sizeof(string), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehi)-400]);
new str[256];
format(str, sizeof(str), "%s.%s", plname, VehicleNames[GetVehicleModel(vehi)-400]);
if(strfind(str, PlayerVehicle[playerid][pVeh1], true) == 0)
{
SetVehicleToRespawn(vehi);
DestroyVehicle(vehi);
veh1[playerid] = 999;
dini_Remove(string);
strmid(PlayerVehicle[playerid][pVeh1], "None", 0, strlen("None"), 255);
GiveCash(playerid, Price);
format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else if(strcmp(str, PlayerVehicle[playerid][pVeh2], true) == 0)
{
SetVehicleToRespawn(vehi);
DestroyVehicle(vehi);
veh2[playerid] = 999;
dini_Remove(string);
strmid(PlayerVehicle[playerid][pVeh2], "None", 0, strlen("None"), 255);
GiveCash(playerid, Price);
format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else if(strcmp(str, PlayerVehicle[playerid][pVeh3], true) == 0)
{
SetVehicleToRespawn(vehi);
DestroyVehicle(vehi);
veh3[playerid] = 999;
dini_Remove(string);
strmid(PlayerVehicle[playerid][pVeh3], "None", 0, strlen("None"), 255);
GiveCash(playerid, Price);
format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else if(strcmp(str, PlayerVehicle[playerid][pVeh4], true) == 0)
{
SetVehicleToRespawn(vehi);
DestroyVehicle(vehi);
veh4[playerid] = 999;
dini_Remove(string);
strmid(PlayerVehicle[playerid][pVeh4], "None", 0, strlen("None"), 255);
GiveCash(playerid, Price);
format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
else if(strcmp(str, PlayerVehicle[playerid][pVeh5], true) == 0)
{
SetVehicleToRespawn(vehi);
DestroyVehicle(vehi);
veh5[playerid] = 999;
dini_Remove(string);
strmid(PlayerVehicle[playerid][pVeh5], "None", 0, strlen("None"), 255);
GiveCash(playerid, Price);
format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
return 1;
}
}