16.01.2013, 11:55
Hello there, I have a question. How can i create command wich will spawn Dealership car ingame?
Vehicles system:
Thats how i need to add sales vehicles ingame now:
I wish to edit prices ingame too:
Another part of script:
Vehicles system:
Код HTML:
else if(strcmp(x_nr,"buy",true) == 0)
{
new car = 1;
new model = GetVehicleModel(idcar);
if(IsASalesVehicle(idcar))
{
if(PlayerInfo[playerid][pLevel] < 2)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!");
return 1;
}
if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999 || PlayerInfo[playerid][pPcarkey4] == 9999 || PlayerInfo[playerid][pPcarkey5] == 9999) { }
else return SendClientMessage(playerid, COLOR_GREY,"* You already own five cars!");
if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
{
if(PlayerInfo[playerid][pCarLic] == 1)
{
for(new h = 1; h < sizeof(CarInfo); h++)
{
if(CarInfo[h][cOwned] == 0)
{
car = h;
h = 9999;
}
}
format(string, sizeof(string),"LARP/Vehicles/%d.ini",car)
dini_Create(string);
if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey] = car; }
else if(PlayerInfo[playerid][pPcarkey2] == 9999) { PlayerInfo[playerid][pPcarkey2] = car; }
else if(PlayerInfo[playerid][pPcarkey3] == 9999) { PlayerInfo[playerid][pPcarkey3] = car; }
else if(PlayerInfo[playerid][pPcarkey4] == 9999) { PlayerInfo[playerid][pPcarkey4] = car; }
else if(PlayerInfo[playerid][pPcarkey5] == 9999) { PlayerInfo[playerid][pPcarkey5] = car; }
else { PlayerInfo[playerid][pPcarkey] = car; }
CarInfo[car][cOwned] = 1;
strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
{
CarInfo[car][cLocationx] = 1775.156;
CarInfo[car][cLocationy] = -2488.442;
CarInfo[car][cLocationz] = 13.355;
CarInfo[car][cAngle] = 359.2072;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Los Santos Airport, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Los Santos Airport!", 5000, 3);
}
else if(IsModelABoat(idcar))
{
CarInfo[car][cLocationx] = -1568.9614;
CarInfo[car][cLocationy] = 169.0118;
CarInfo[car][cLocationz] = -0.6016;
CarInfo[car][cAngle] = 208.7506;
SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to Santos Unity Station, you can get it there!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Santos Unity Station!", 5000, 3);
}
else
{
CarInfo[car][cLocationx] = 1776.538;
CarInfo[car][cLocationy] = -1905.815;
CarInfo[car][cLocationz] = 13.212;
CarInfo[car][cAngle] = 317.1649;
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to Los Santos , Near The Taxi Company /findcar ID to find your car!");
SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
}
CarInfo[car][cModel] = model;
CarInfo[car][cVirWorld] = 0;
CarInfo[car][cPaintjob] = 999;
CarInfo[car][cColorOne] = 0;
CarInfo[car][cColorTwo] = 0;
CarInfo[car][cComponent0] = 0;
CarInfo[car][cComponent1] = 0;
CarInfo[car][cComponent2] = 0;
CarInfo[car][cComponent3] = 0;
CarInfo[car][cComponent4] = 0;
CarInfo[car][cComponent5] = 0;
CarInfo[car][cComponent6] = 0;
CarInfo[car][cComponent7] = 0;
CarInfo[car][cComponent8] = 0;
CarInfo[car][cComponent9] = 0;
CarInfo[car][cComponent10] = 0;
CarInfo[car][cComponent11] = 0;
CarInfo[car][cComponent12] = 0;
CarInfo[car][cComponent13] = 0;
DestroyVehicle(car);
ownedcar[car] = CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,30000);
PlayerPlayMusic(playerid);
SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
gEngine[playerid] = 0;
engineOn[GetPlayerVehicleID(playerid)] = false;
SendClientMessage(playerid, COLOR_GREY, "Remember to set the new Security Code of the Car!");
new pass[24];
format(pass, sizeof(pass),"%d%d%d",random(9),random(9),random(9));
CarInfo[car][cCode] = strval(pass);
OnPropUpdate(4,car);
OnPlayerUpdateEx(playerid);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have enough cash with you ! ");
return 1;
}
}
}
Код HTML:
// CARS new armycar[456]; new governcar[9]; new copcar[18]; new freecar[4]; new swatcar[11]; new mobcar[14]; new fbicar[12]; new DonorCar[7]; new tacticalcar[9]; new ambulance[14]; new surenoscar[15]; new fuujocar[5]; new fdcar[114]; new rentcar[20]; new harvest[4]; new drugharvest[4]; new Triadscar[13]; new Ballascar[5]; new ownedcar[sizeof(CarInfo)]; new developercar[52]; new anarchybike[14]; new salescar[163]; new hitmencar[14]; new grovecar[10]; new rentveh[1]; new createdcar[MAX_VEHICLES];
Код HTML:
salescar[0] = AddStaticVehicleEx(541,543.0609,-1290.8246,16.8670,358.5973,1,0,30000); // SALES
Код HTML:
public IsASalesVehicle(vehicleid) { for(new i = 0; i < sizeof(salescar); i++) { if(vehicleid == salescar[i]) return 1; } return 0; }
Код HTML:
public GetVehiclePrice(vehicleid) { new model = GetVehicleModel(vehicleid); if(model == 400) return 109000; else if(model == 401) return 40799; else if(model == 402) return 75799; else if(model == 403) return 90000; else if(model == 404) return 25000; else if(model == 405) return 51799; else if(model == 406) return 200000; else if(model == 408) return 130000; else if(model == 409) return 90000; else if(model == 410) return 25000; else if(model == 411) return 150000; else if(model == 412) return 60000; else if(model == 413) return 55000; else if(model == 414) return 75000; else if(model == 415) return 456298; else if(model == 417) return 250000; else if(model == 418) return 20000; else if(model == 419) return 30000; else if(model == 420) return 50512; else if(model == 421) return 75000; else if(model == 422) return 60000; else if(model == 423) return 100000; else if(model == 424) return 85000; else if(model == 426) return 80000; else if(model == 428) return 40000; else if(model == 429) return 125000; else if(model == 434) return 150000; else if(model == 436) return 45000; else if(model == 439) return 55000; else if(model == 443) return 100000; else if(model == 444) return 175000; else if(model == 445) return 75000; else if(model == 446) return 175000; else if(model == 451) return 150000; else if(model == 452) return 175000; else if(model == 453) return 125000; else if(model == 454) return 130000; else if(model == 455) return 80000; else if(model == 456) return 70000; else if(model == 457) return 85000; else if(model == 458) return 50000; else if(model == 459) return 60000; else if(model == 460) return 215000; else if(model == 461) return 40000; else if(model == 462) return 20000; else if(model == 463) return 35000; else if(model == 466) return 70000; else if(model == 467) return 70000; else if(model == 468) return 35000; else if(model == 469) return 175000; else if(model == 471) return 15000; else if(model == 473) return 125000; else if(model == 474) return 65000; else if(model == 475) return 65000; else if(model == 477) return 100000; else if(model == 478) return 40000; else if(model == 479) return 75000; else if(model == 480) return 75729; else if(model == 481) return 5000; else if(model == 482) return 65000; else if(model == 483) return 70000; else if(model == 484) return 125000; else if(model == 485) return 30000; else if(model == 486) return 150000; else if(model == 487) return 200000; else if(model == 489) return 75000; else if(model == 491) return 60000; else if(model == 492) return 70000; else if(model == 493) return 200000; else if(model == 494) return 100000; else if(model == 495) return 90000; else if(model == 496) return 60000; else if(model == 498) return 80000; else if(model == 499) return 80000; else if(model == 500) return 70000; else if(model == 502) return 100000; else if(model == 503) return 100000; else if(model == 504) return 100000; else if(model == 505) return 75000; else if(model == 506) return 115000; else if(model == 507) return 75000; else if(model == 508) return 80299; else if(model == 509) return 2500; else if(model == 510) return 10000; else if(model == 511) return 215000; else if(model == 512) return 200000; else if(model == 513) return 220000; else if(model == 514) return 90000; else if(model == 515) return 90000; else if(model == 516) return 67500; else if(model == 517) return 70000; else if(model == 518) return 42598; else if(model == 519) return 300000; else if(model == 521) return 35000; else if(model == 522) return 75000; else if(model == 524) return 80000; else if(model == 525) return 30000; else if(model == 526) return 65000; else if(model == 527) return 65000; else if(model == 529) return 70000; else if(model == 530) return 90000; else if(model == 531) return 40000; else if(model == 532) return 200000; else if(model == 533) return 70000; else if(model == 534) return 76000; else if(model == 535) return 80000; else if(model == 536) return 75000; else if(model == 539) return 150000; else if(model == 540) return 70000; else if(model == 541) return 500799; else if(model == 542) return 80000; else if(model == 543) return 50000; else if(model == 545) return 125000; else if(model == 546) return 70000; else if(model == 547) return 70000; else if(model == 549) return 60000; else if(model == 550) return 90000; else if(model == 551) return 80000; else if(model == 552) return 30000; else if(model == 553) return 250000; else if(model == 554) return 50000; else if(model == 555) return 50000; else if(model == 556) return 200000; else if(model == 557) return 200000; else if(model == 558) return 70000; else if(model == 559) return 70000; else if(model == 560) return 115000; else if(model == 561) return 50000; else if(model == 562) return 95000; else if(model == 563) return 200000; else if(model == 565) return 90000; else if(model == 566) return 70000; else if(model == 567) return 75000; else if(model == 568) return 50000; else if(model == 571) return 85000; else if(model == 572) return 15000; else if(model == 573) return 90000; else if(model == 575) return 80000; else if(model == 576) return 65000; else if(model == 578) return 90000; else if(model == 579) return 90000; else if(model == 580) return 75000; else if(model == 581) return 30000; else if(model == 583) return 25000; else if(model == 585) return 35000; else if(model == 586) return 20000; else if(model == 587) return 90000; else if(model == 588) return 90000; else if(model == 589) return 90000; else if(model == 592) return 350000; else if(model == 593) return 225000; else if(model == 600) return 50000; else if(model == 602) return 75000; else if(model == 603) return 344299; else if(model == 609) return 85000; else return 0; }
Код HTML:
else if(IsASalesVehicle(vehicleid)) { CanTurnEngine[playerid] = 9999; SendClientMessage(playerid, COLOR_CREAM, "You are not allowed to move Dealership car vehicles away."); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); TextDrawHideForPlayer(playerid, Textdraw53[playerid]); LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0); format(string,sizeof(string)," %s (%d) Owner: Dealership",vehicle, vehicleid); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); SetTimer("GateClose", 4000, 0); format(string,sizeof(string),"Type /v buy to buy this car for $%d",GetVehiclePrice(vehicleid)); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); }