Ну вот если продать машину, то должно быть какой-то транспортное средство - у меня это мопед. Например вот продажа машины в гос / на руки:
PHP Code:
CMD:sellcar(playerid, params[]) // команда
{
if(PlayerInfo[playerid][pPhousekey] == 255) return SendClientMessage(playerid, COLOR_GREY, "Вы не владеете домом!");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Вы не в машине!");
if(GetPlayerVehicleID(playerid) != caridhouse[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Вы должны находиться в вашем личном транспорте!");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 462) return SendClientMessage(playerid, COLOR_GREY, "Вы не можете продать мопед!");
if(sscanf(params, "dd", params[0], params[1])) return SPD(playerid, 77, 0, "Продать транспорт", "{FFFFFF}Вы хотите продать свой транспорт?\n\n{FF6347}Внимание! Вам вернут только половину стоимости транспорта!\n\n Для продажи авто игроку, введите /sellcar [id] [цена]", "Да", "Нет");
if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid, COLOR_GREY, "Игрок оффлайн");
if(params[0] == playerid) return SendClientMessage(playerid, COLOR_GREY, "Вы не можете продать транспорт себе!");
if(PlayerInfo[params[0]][pPhousekey] == 255) return SendClientMessage(playerid, COLOR_GREY, "У игрока нет дома");
if(!IsPlayerInVehicle(params[0], GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_GREY, "Игрок должен находиться с вами в транспорте!");
if(params[1] < 1 || params[1] > 5000000) return SendClientMessage(playerid, COLOR_GREY, "Стоимость от 1 до 5000000$!");
format(stringer, 256, "{FFFF00}%s (ID: %i) предложил вам продать свой транспорт\n(Модель: %s, Стоимость: %i)\n\t\tВы согласны?",PlayerInfo[playerid][pNames],playerid,VehicleNameS[GetVehicleModel(GetPlayerVehicleID(playerid))-400],params[1]);
SPD(params[0], 79, 0, "Купить транспорт", stringer, "Да", "Нет");
format(stringer, 131, "{FFFFFF}Вы предложили %s продать свое авто{FFFF00} (Модель: %s, Стоимость: %i)",PlayerInfo[params[0]][pNames], VehicleNameS[GetVehicleModel(GetPlayerVehicleID(playerid))-400], params[1]);
SendClientMessage(playerid,COLOR_GREY,stringer);
SetPVarInt(params[0], "CarPlayer", playerid);
SetPVarInt(params[0], "CarPrice", params[1]);
return true;
}
Продажа в гос:
PHP Code:
case 77:
{
if(!response) return true;
switch(PlayerInfo[playerid][pCar])
{
case 400:PlayerInfo[playerid][pCash] += 65000;
case 404:PlayerInfo[playerid][pCash] += 50000;
case 436:PlayerInfo[playerid][pCash] += 50000;
case 439:PlayerInfo[playerid][pCash] += 75000;
case 458:PlayerInfo[playerid][pCash] += 60000;
case 466:PlayerInfo[playerid][pCash] += 55000;
case 475:PlayerInfo[playerid][pCash] += 95000;
case 478:PlayerInfo[playerid][pCash] += 50000;
case 479:PlayerInfo[playerid][pCash] += 55000;
case 492:PlayerInfo[playerid][pCash] += 70000;
case 516:PlayerInfo[playerid][pCash] += 70000;
case 517:PlayerInfo[playerid][pCash] += 75000;
case 518:PlayerInfo[playerid][pCash] += 85000;
case 526:PlayerInfo[playerid][pCash] += 55000;
case 527:PlayerInfo[playerid][pCash] += 50000;
case 542:PlayerInfo[playerid][pCash] += 60000;
case 543:PlayerInfo[playerid][pCash] += 50000;
case 546:PlayerInfo[playerid][pCash] += 70000;
case 547:PlayerInfo[playerid][pCash] += 55000;
case 549:PlayerInfo[playerid][pCash] += 60000;
case 567:PlayerInfo[playerid][pCash] += 100000;
case 419:PlayerInfo[playerid][pCash] += 400000;
case 421:PlayerInfo[playerid][pCash] += 415000;
case 445:PlayerInfo[playerid][pCash] += 405000;
case 489:PlayerInfo[playerid][pCash] += 440000;
case 491:PlayerInfo[playerid][pCash] += 400000;
case 533:PlayerInfo[playerid][pCash] += 410000;
case 534:PlayerInfo[playerid][pCash] += 360000;
case 554:PlayerInfo[playerid][pCash] += 420000;
case 555:PlayerInfo[playerid][pCash] += 500000;
case 561:PlayerInfo[playerid][pCash] += 405000;
case 579:PlayerInfo[playerid][pCash] += 465000;
case 580:PlayerInfo[playerid][pCash] += 500000;
case 589:PlayerInfo[playerid][pCash] += 350000;
case 603:PlayerInfo[playerid][pCash] += 400000;
case 418:PlayerInfo[playerid][pCash] += 350000;
case 461:PlayerInfo[playerid][pCash] += 500000;
case 581:PlayerInfo[playerid][pCash] += 500000;
case 586:PlayerInfo[playerid][pCash] += 400000;
case 401:PlayerInfo[playerid][pCash] += 170000;
case 405:PlayerInfo[playerid][pCash] += 200000;
case 412:PlayerInfo[playerid][pCash] += 175000;
case 422:PlayerInfo[playerid][pCash] += 155000;
case 426:PlayerInfo[playerid][pCash] += 210000;
case 467:PlayerInfo[playerid][pCash] += 185000;
case 474:PlayerInfo[playerid][pCash] += 185000;
case 496:PlayerInfo[playerid][pCash] += 240000;
case 507:PlayerInfo[playerid][pCash] += 225000;
case 529:PlayerInfo[playerid][pCash] += 220000;
case 536:PlayerInfo[playerid][pCash] += 200000;
case 540:PlayerInfo[playerid][pCash] += 165000;
case 550:PlayerInfo[playerid][pCash] += 240000;
case 551:PlayerInfo[playerid][pCash] += 240000;
case 566:PlayerInfo[playerid][pCash] += 175000;
case 575:PlayerInfo[playerid][pCash] += 230000;
case 576:PlayerInfo[playerid][pCash] += 175000;
case 585:PlayerInfo[playerid][pCash] += 175000;
case 600:PlayerInfo[playerid][pCash] += 210000;
case 402:PlayerInfo[playerid][pCash] += 1500000;
case 411:PlayerInfo[playerid][pCash] += 1500000;
case 415:PlayerInfo[playerid][pCash] += 1500000;
case 429:PlayerInfo[playerid][pCash] += 1500000;
case 451:PlayerInfo[playerid][pCash] += 2000000;
case 506:PlayerInfo[playerid][pCash] += 1500000;
case 541:PlayerInfo[playerid][pCash] += 2000000;
case 522:PlayerInfo[playerid][pCash] += 1500000;
case 434:PlayerInfo[playerid][pCash] += 1600000;
case 477:PlayerInfo[playerid][pCash] += 950000;
case 480:PlayerInfo[playerid][pCash] += 1000000;
case 535:PlayerInfo[playerid][pCash] += 850000;
case 545:PlayerInfo[playerid][pCash] += 700000;
case 558:PlayerInfo[playerid][pCash] += 850000;
case 559:PlayerInfo[playerid][pCash] += 900000;
case 560:PlayerInfo[playerid][pCash] += 895000;
case 562:PlayerInfo[playerid][pCash] += 900000;
case 565:PlayerInfo[playerid][pCash] += 900000;
case 587:PlayerInfo[playerid][pCash] += 900000;
case 602:PlayerInfo[playerid][pCash] += 800000;
case 521:PlayerInfo[playerid][pCash] += 800000;
case 463:PlayerInfo[playerid][pCash] += 800000;
case 468:PlayerInfo[playerid][pCash] += 700000;
}
PlayerInfo[playerid][pKolesocar] = 0;
PlayerInfo[playerid][pSpoiler] = 0;
PlayerInfo[playerid][pHood] = 0;
PlayerInfo[playerid][pExhaust] = 0;
PlayerInfo[playerid][pLamps] = 0;
PlayerInfo[playerid][pSideskirt] = 0;
PlayerInfo[playerid][pVozdyx] = 0;
PlayerInfo[playerid][pBamper1] = 0;
PlayerInfo[playerid][pBamper2] = 0;
PlayerInfo[playerid][pPokraska] = 255;
PlayerInfo[playerid][pNitro] = 0;
PlayerInfo[playerid][pGidra] = 0;
SendClientMessage(playerid,COLOR_WHITE,"Âû ïðîäàëè ñâîé àâòîìîáèëü!");
PlayerInfo[playerid][pCar] = 462;
if(caridhouse[playerid] != -1)
{
DestroyVehicle(caridhouse[playerid]);
caridhouse[playerid] = -1;
}
new house = PlayerInfo[playerid][pPhousekey];
caridhouse[playerid] = CreateVehicle(PlayerInfo[playerid][pCar], HouseInfo[house][hCarx], HouseInfo[house][hCary], HouseInfo[house][hCarz], HouseInfo[house][hCarc] , PlayerInfo[playerid][pVcol1], PlayerInfo[playerid][pVcol2],7200);
PlayerInfo[playerid][pFuelcar] = 100;
Fuell[caridhouse[playerid]] = PlayerInfo[playerid][pFuelcar];
OnPlayerUpdateRL(playerid);
}
Продажа на руки:
PHP Code:
case 79:
{
new playerd = GetPVarInt(playerid, "CarPlayer"), price = GetPVarInt(playerid, "CarPrice");
if(response)
{
if(PlayerInfo[playerid][pCash] < price)
{
SendClientMessage(playerid, COLOR_GREY, "У вас не достаточно денег");
format(stringer1, 100, "У %s недостаточно средств", PlayerInfo[playerid][pNames]);
SendClientMessage(playerd,COLOR_WHITE,stringer1);
DeletePVar(playerid, "CarPrice");
DeletePVar(playerid, "CarPlayer");
return true;
}
PlayerInfo[playerid][pCar] = PlayerInfo[playerd][pCar];
PlayerInfo[playerid][pFuelcar] = PlayerInfo[playerd][pFuelcar];
PlayerInfo[playerid][pVcol1] = PlayerInfo[playerd][pVcol1];
PlayerInfo[playerid][pVcol2] = PlayerInfo[playerd][pVcol2];
PlayerInfo[playerid][pPokraska] = PlayerInfo[playerd][pPokraska];
PlayerInfo[playerid][pKolesocar] = PlayerInfo[playerd][pKolesocar];
PlayerInfo[playerid][pSpoiler] = PlayerInfo[playerd][pSpoiler];
PlayerInfo[playerid][pHood] = PlayerInfo[playerd][pHood];
PlayerInfo[playerid][pExhaust] = PlayerInfo[playerd][pExhaust];
PlayerInfo[playerid][pLamps] = PlayerInfo[playerd][pLamps];
PlayerInfo[playerid][pSideskirt] = PlayerInfo[playerd][pSideskirt];
PlayerInfo[playerid][pVozdyx] = PlayerInfo[playerd][pVozdyx];
PlayerInfo[playerid][pBamper1] = PlayerInfo[playerd][pBamper1];
PlayerInfo[playerid][pBamper2] = PlayerInfo[playerd][pBamper2];
PlayerInfo[playerid][pNitro] = PlayerInfo[playerd][pNitro];
PlayerInfo[playerid][pGidra] = PlayerInfo[playerd][pGidra];
if(caridhouse[playerid] != -1)
{
DestroyVehicle(caridhouse[playerid]);
caridhouse[playerid] = -1;
}
if(caridhouse[playerd] != -1)
{
DestroyVehicle(caridhouse[playerd]);
caridhouse[playerd] = -1;
}
new house = PlayerInfo[playerid][pPhousekey];
caridhouse[playerid] = CreateVehicle(PlayerInfo[playerid][pCar], HouseInfo[house][hCarx], HouseInfo[house][hCary], HouseInfo[house][hCarz], HouseInfo[house][hCarc], PlayerInfo[playerid][pVcol1], PlayerInfo[playerid][pVcol2], 7200);
LockCar(caridhouse[playerid]);
Fuell[caridhouse[playerid]] = PlayerInfo[playerid][pFuelcar];
SetVehicleNumberPlate(caridhouse[playerid], PlayerInfo[playerid][pNumbercar]);
if(PlayerInfo[playerid][pKolesocar] != 0) AddVehicleComponent (caridhouse[playerid], PlayerInfo[playerid][pKolesocar]);
if(PlayerInfo[playerid][pNitro] != 0) AddVehicleComponent (caridhouse[playerid], PlayerInfo[playerid][pNitro]);
if(PlayerInfo[playerid][pGidra] != 0) AddVehicleComponent (caridhouse[playerid], PlayerInfo[playerid][pGidra]);
if(PJ(caridhouse[playerid]))
{
if(PlayerInfo[playerid][pPokraska] != 255) ChangeVehiclePaintjob(caridhouse[playerid],PlayerInfo[playerid][pPokraska]);
if(PlayerInfo[playerid][pSpoiler] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pSpoiler]);
if(PlayerInfo[playerid][pHood] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pHood]);
if(PlayerInfo[playerid][pExhaust] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pExhaust]);
if(PlayerInfo[playerid][pLamps] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pLamps]);
if(PlayerInfo[playerid][pSideskirt] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pSideskirt]);
if(PlayerInfo[playerid][pVozdyx] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pVozdyx]);
if(PlayerInfo[playerid][pBamper1] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pBamper1]);
if(PlayerInfo[playerid][pBamper2] != 0) AddVehicleComponent(caridhouse[playerid],PlayerInfo[playerid][pBamper2]);
}
new houses = PlayerInfo[playerd][pPhousekey];
PlayerInfo[playerd][pCar] = 462;
caridhouse[playerd] = CreateVehicle(PlayerInfo[playerd][pCar], HouseInfo[houses][hCarx], HouseInfo[houses][hCary], HouseInfo[houses][hCarz], HouseInfo[houses][hCarc], PlayerInfo[playerd][pVcol1], PlayerInfo[playerd][pVcol2],7200);
LockCar(caridhouse[playerd]);
Fuell[caridhouse[playerd]] = PlayerInfo[playerd][pFuelcar]+20;
PlayerInfo[playerd][pKolesocar] = 0;
PlayerInfo[playerd][pSpoiler] = 0;
PlayerInfo[playerd][pHood] = 0;
PlayerInfo[playerd][pExhaust] = 0;
PlayerInfo[playerd][pLamps] = 0;
PlayerInfo[playerd][pSideskirt] = 0;
PlayerInfo[playerd][pVozdyx] = 0;
PlayerInfo[playerd][pBamper1] = 0;
PlayerInfo[playerd][pBamper2] = 0;
PlayerInfo[playerd][pPokraska] = 255;
PlayerInfo[playerd][pNitro] = 0;
PlayerInfo[playerd][pGidra] = 0;
format(stringer1, 100, "Вы продали авто %s за %i вирт", PlayerInfo[playerid][pNames], price);
SendClientMessage(playerd,COLOR_LIGHTBLUE,stringer1);
format(stringer1, 100, "%s продал вам авто за %i вирт", PlayerInfo[playerd][pNames], price);
SendClientMessage(playerid,COLOR_LIGHTBLUE,stringer1);
PlayerInfo[playerd][pCash] +=price;
PlayerInfo[playerid][pCash] -= price;
}
else
{
format(stringer1, 100, "%s отклонил предложение о продаже", PlayerInfo[playerid][pNames]);
SendClientMessage(playerd,COLOR_LIGHTBLUE,stringer1);
}
DeletePVar(playerid, "CarPrice");
DeletePVar(playerid, "CarPlayer");
}