I'm trying to find a way to make it purchase-able again after you sell a car ( Dealership )
Whenever i sell the vehicle, and attempt to sell again, it says i need to despawn it " You have already spawned your car (( despawn it using /despawn ))" or either the health of the vehicle is low, any idea how to fix it and manage to buy cars again?
( /sellcartomarket confirm - You gotta enter the car to sell it )
This is the command to /despawn
Whenever i sell the vehicle, and attempt to sell again, it says i need to despawn it " You have already spawned your car (( despawn it using /despawn ))" or either the health of the vehicle is low, any idea how to fix it and manage to buy cars again?
( /sellcartomarket confirm - You gotta enter the car to sell it )
Code:
CMD:sellcartomarket(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pVeh] && !PlayerInfo[playerid][pVVeh] && !PlayerInfo[playerid][pVVVeh]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
if(GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVVeh] && GetPlayerVehicleID(playerid) != PlayerInfo[playerid][pVVVeh]) return SendClientMessage(playerid, COLOR_GREY, "You must be in the vehicle you wish to sell to the dealership.");
if(sscanf(params, "s[8]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /sellcartomarket [confirm]");
// Start of Payback
new price;
if(!strcmp(params, "confirm", true))
// BMX ($600)\nFaggio ($4,000)\nFreeway ($6,000)\nSanchez ($4,000)\nQuad ($6,000)\nPCJ-600 ($20,000)\nFCR-900 ($25,000)
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 481) price = 500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 462) price = 1000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 586) price = 9000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 463) price = 14000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 521) price = 17000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 581) price = 19000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 461) price = 20000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 471) price = 15000;// End of Bikes
// Comet ($30,000)\nFeltzer ($26,000)\nStallion ($26,000)\nWindsor ($28,000)\nSentinel ($24,000)\nManana ($22,000)
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 466) price = 1500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 543) price = 1300;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 401) price = 2000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 542) price = 2500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 517) price = 2150;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 404) price = 1000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 549) price = 1500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 529) price = 2500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 540) price = 2350;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 600) price = 13000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 478) price = 15000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 554) price = 17000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 422) price = 15000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 492) price = 12500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 551) price = 12500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 426) price = 16500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 491) price = 11000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 507) price = 14500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 421) price = 15000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 445) price = 19500;// End of Normal Vehicles
// Huntley ($22,000)\nLandstalker ($24,000)\nSandking ($30,000)
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 400) price = 14000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 500) price = 25000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 505) price = 16000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 579) price = 21000; // End of Off-Road vehicles
// Sultan ($60,000)\nBanshee ($65,000)\nBuffalo ($70,000)\nBullet ($90,000)\nCheetah ($80,000)\nJester ($70,000)\nTurismo ($110,000)\nSuper GT(200,000$)\nInfernus($300,000)
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 475) price = 27000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 496) price = 25000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 602) price = 38500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 587) price = 32000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 477) price = 34000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 589) price = 29000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 560) price = 50000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 480) price = 60000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 506) price = 75000; // End of Sport vehicles
// Blade($25,000)\nBroadway ($35,000)\nRemington ($30,000)\nSavanna ($25,000)\nSlamvan ($27,000)\nTornado ($24,000)\nVoodo ($30,000)
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 412) price = 8500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 536) price = 8500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 567) price = 10000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 575) price = 10000;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 566) price = 8500;
else if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 534) price = 9250;
GiveDodMoney(playerid, (75*price)/100);
neon[playerid] = 1;
vneon[playerid] = 1;
// End of Payback
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{
DestroyObject(GetPVarInt(playerid, "neon"));
DestroyObject(GetPVarInt(playerid, "neon1"));
DestroyObject(GetPVarInt(playerid, "neon2"));
DestroyObject(GetPVarInt(playerid, "neon3"));
DestroyObject(GetPVarInt(playerid, "neon4"));
DestroyObject(GetPVarInt(playerid, "neon5"));
DestroyObject(GetPVarInt(playerid, "neon6"));
DestroyObject(GetPVarInt(playerid, "neon7"));
DestroyObject(GetPVarInt(playerid, "neon8"));
DestroyObject(GetPVarInt(playerid, "neon9"));
DestroyObject(GetPVarInt(playerid, "neon10"));
DestroyObject(GetPVarInt(playerid, "neon11"));
DestroyObject(GetPVarInt(playerid, "nb1"));
DestroyObject(GetPVarInt(playerid, "nb2"));
DestroyObject(GetPVarInt(playerid, "nb3"));
DestroyObject(GetPVarInt(playerid, "nb4"));
DestroyObject(GetPVarInt(playerid, "nb5"));
DestroyObject(GetPVarInt(playerid, "nb6"));
neon[playerid] = 1;
DestroyVehicle(PlayerInfo[playerid][pVeh]);
PlayerInfo[playerid][pVeh] = 0;
PlayerInfo[playerid][vModel] = 0;
PlayerInfo[playerid][vX] = 0;
PlayerInfo[playerid][vY] = 0;
PlayerInfo[playerid][vZ] = 0;
PlayerInfo[playerid][vA] = 0;
PlayerInfo[playerid][vC1] = 0;
PlayerInfo[playerid][vC2] = 0;
PlayerInfo[playerid][pTWeed] = 0;
PlayerInfo[playerid][pTcocaine] = 0;
PlayerInfo[playerid][pTGun][0] = 0;
PlayerInfo[playerid][pTGunAmmo][0] = 0;
PlayerInfo[playerid][pTGun][1] = 0;
PlayerInfo[playerid][pTGunAmmo][1] = 0;
PlayerInfo[playerid][pvTWeed] = 0;
PlayerInfo[playerid][pvTcocaine] = 0;
PlayerInfo[playerid][pvvTWeed] = 0;
PlayerInfo[playerid][pvvTcocaine] = 0;
PlayerInfo[playerid][pvvvTWeed] = 0;
PlayerInfo[playerid][pvvvTcocaine] = 0;
PlayerInfo[playerid][pvTGun][0] = 0;
PlayerInfo[playerid][pvTGunAmmo][0] = 0;
PlayerInfo[playerid][pvTGun][1] = 0;
PlayerInfo[playerid][pvTGunAmmo][1] = 0;
PlayerInfo[playerid][pvvTGun][0] = 0;
PlayerInfo[playerid][pvvTGunAmmo][0] = 0;
PlayerInfo[playerid][pvvTGun][1] = 0;
PlayerInfo[playerid][pvvTGunAmmo][1] = 0;
//
PlayerInfo[playerid][pvvvTGun][0] = 0;
PlayerInfo[playerid][pvvvTGunAmmo][0] = 0;
PlayerInfo[playerid][pvvvTGun][1] = 0;
PlayerInfo[playerid][pvvvTGunAmmo][1] = 0;
SendClientMessage(playerid, COLOR_GREEN, " You have sold your vehicle to the dealership. (75 percent of the original price was paid back)");
}
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{
DestroyObject(GetPVarInt(playerid, "vneon"));
DestroyObject(GetPVarInt(playerid, "vneon1"));
DestroyObject(GetPVarInt(playerid, "vneon2"));
DestroyObject(GetPVarInt(playerid, "vneon3"));
DestroyObject(GetPVarInt(playerid, "vneon4"));
DestroyObject(GetPVarInt(playerid, "vneon5"));
DestroyObject(GetPVarInt(playerid, "vneon6"));
DestroyObject(GetPVarInt(playerid, "vneon7"));
DestroyObject(GetPVarInt(playerid, "vneon8"));
DestroyObject(GetPVarInt(playerid, "vneon9"));
DestroyObject(GetPVarInt(playerid, "vneon10"));
DestroyObject(GetPVarInt(playerid, "vneon11"));
DestroyObject(GetPVarInt(playerid, "vnb1"));
DestroyObject(GetPVarInt(playerid, "vnb2"));
DestroyObject(GetPVarInt(playerid, "vnb3"));
DestroyObject(GetPVarInt(playerid, "vnb4"));
DestroyObject(GetPVarInt(playerid, "vnb5"));
DestroyObject(GetPVarInt(playerid, "vnb6"));
vneon[playerid] = 1;
DestroyVehicle(PlayerInfo[playerid][pVVeh]);
PlayerInfo[playerid][pVVeh] = 0;
PlayerInfo[playerid][vVModel] = 0;
PlayerInfo[playerid][vVX] = 0;
PlayerInfo[playerid][vVY] = 0;
PlayerInfo[playerid][vVZ] = 0;
PlayerInfo[playerid][vVA] = 0;
PlayerInfo[playerid][vVC1] = 0;
PlayerInfo[playerid][vVC2] = 0;
SendClientMessage(playerid, COLOR_GREEN, " You have sold your vehicle to the dealership. (75 percent of the original price was paid back)");
}
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVeh])
{
DestroyObject(GetPVarInt(playerid, "vneon"));
DestroyObject(GetPVarInt(playerid, "vneon1"));
DestroyObject(GetPVarInt(playerid, "vneon2"));
DestroyObject(GetPVarInt(playerid, "vneon3"));
DestroyObject(GetPVarInt(playerid, "vneon4"));
DestroyObject(GetPVarInt(playerid, "vneon5"));
DestroyObject(GetPVarInt(playerid, "vneon6"));
DestroyObject(GetPVarInt(playerid, "vneon7"));
DestroyObject(GetPVarInt(playerid, "vneon8"));
DestroyObject(GetPVarInt(playerid, "vneon9"));
DestroyObject(GetPVarInt(playerid, "vneon10"));
DestroyObject(GetPVarInt(playerid, "vneon11"));
DestroyObject(GetPVarInt(playerid, "vnb1"));
DestroyObject(GetPVarInt(playerid, "vnb2"));
DestroyObject(GetPVarInt(playerid, "vnb3"));
DestroyObject(GetPVarInt(playerid, "vnb4"));
DestroyObject(GetPVarInt(playerid, "vnb5"));
DestroyObject(GetPVarInt(playerid, "vnb6"));
vneon[playerid] = 1;
DestroyVehicle(PlayerInfo[playerid][pVVVeh]);
PlayerInfo[playerid][pVVVeh] = 0;
PlayerInfo[playerid][vVVModel] = 0;
PlayerInfo[playerid][vVVX] = 0;
PlayerInfo[playerid][vVVY] = 0;
PlayerInfo[playerid][vVVZ] = 0;
PlayerInfo[playerid][vVVA] = 0;
PlayerInfo[playerid][vVVC1] = 0;
PlayerInfo[playerid][vVVC2] = 0;
SendClientMessage(playerid, COLOR_GREEN, " You have sold your vehicle to the dealership. (75 percent of the original price was paid back)");
}
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVVVeh])
{
DestroyObject(GetPVarInt(playerid, "vneon"));
DestroyObject(GetPVarInt(playerid, "vneon1"));
DestroyObject(GetPVarInt(playerid, "vneon2"));
DestroyObject(GetPVarInt(playerid, "vneon3"));
DestroyObject(GetPVarInt(playerid, "vneon4"));
DestroyObject(GetPVarInt(playerid, "vneon5"));
DestroyObject(GetPVarInt(playerid, "vneon6"));
DestroyObject(GetPVarInt(playerid, "vneon7"));
DestroyObject(GetPVarInt(playerid, "vneon8"));
DestroyObject(GetPVarInt(playerid, "vneon9"));
DestroyObject(GetPVarInt(playerid, "vneon10"));
DestroyObject(GetPVarInt(playerid, "vneon11"));
DestroyObject(GetPVarInt(playerid, "vnb1"));
DestroyObject(GetPVarInt(playerid, "vnb2"));
DestroyObject(GetPVarInt(playerid, "vnb3"));
DestroyObject(GetPVarInt(playerid, "vnb4"));
DestroyObject(GetPVarInt(playerid, "vnb5"));
DestroyObject(GetPVarInt(playerid, "vnb6"));
vneon[playerid] = 1;
DestroyVehicle(PlayerInfo[playerid][pVVVVeh]);
PlayerInfo[playerid][pVVVVeh] = 0;
PlayerInfo[playerid][vVVVModel] = 0;
PlayerInfo[playerid][vVVVX] = 0;
PlayerInfo[playerid][vVVVY] = 0;
PlayerInfo[playerid][vVVVZ] = 0;
PlayerInfo[playerid][vVVVA] = 0;
PlayerInfo[playerid][vVVVC1] = 0;
PlayerInfo[playerid][vVVVC2] = 0;
SendClientMessage(playerid, COLOR_GREEN, " You have sold your vehicle to the dealership. (75 percent of the original price was paid back)");
}
return 1;
}
Code:
CMD:despawn(playerid, params[])
{
new vslots, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(sscanf(params, "i", vslots)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /despawn [1-4]");
if(vslots < 1 || vslots > 4) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /despawn [1-4]");
switch(vslots)
{
case 1:
{
new Float:health, veh = PlayerInfo[playerid][pVeh];
GetVehicleHealth(veh, health);
if(PlayerInfo[playerid][pAdmin] && PlayerInfo[playerid][pVIP] >= 2) return SendClientMessage(playerid, COLOR_GREY, "Your V.I.P vehicle cannot be despawned.");
if(vspawned[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have spawned car.");
if(health <= 650) return SendClientMessage(playerid, COLOR_RED, "This vehicle is too damaged !");
if(PlayerInfo[playerid][vModel] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have vehicle in this slot.");
{
if(PlayerInfo[playerid][vModel])
{
DestroyVehicle(PlayerInfo[playerid][pVeh]);
}
v1spawned[playerid] = 0;
vspawned[playerid] = 0;
format(string, sizeof(string), "You have despawned your %s.", RVN(PlayerInfo[playerid][vModel]));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
case 2:
{
new Float:health, veh = PlayerInfo[playerid][pVVeh];
GetVehicleHealth(veh, health);
if(vspawned[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have spawned car.");
if(health <= 650) return SendClientMessage(playerid, COLOR_RED, "This vehicle is too damaged !");
if(PlayerInfo[playerid][vVModel] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have vehicle in this slot.");
{
if(PlayerInfo[playerid][vVModel])
{
DestroyVehicle(PlayerInfo[playerid][pVVeh]);
}
v2spawned[playerid] = 0;
vspawned[playerid] = 0;
format(string, sizeof(string), "You have despawned your %s.", RVN(PlayerInfo[playerid][vVModel]));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
case 3:
{
new Float:health, veh = PlayerInfo[playerid][pVVVeh];
GetVehicleHealth(veh, health);
if(vspawned[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have spawned car.");
if(health <= 650) return SendClientMessage(playerid, COLOR_RED, "This vehicle is too damaged !");
if(PlayerInfo[playerid][vVVModel] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have vehicle in this slot.");
{
if(PlayerInfo[playerid][vVVModel])
{
DestroyVehicle(PlayerInfo[playerid][pVVVeh]);
}
v3spawned[playerid] = 0;
vspawned[playerid] = 0;
format(string, sizeof(string), "You have despawned your %s.", RVN(PlayerInfo[playerid][vVVModel]));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
case 4:
{
new Float:health, veh = PlayerInfo[playerid][pVVVVeh];
GetVehicleHealth(veh, health);
if(vspawned[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have spawned car.");
if(health <= 650) return SendClientMessage(playerid, COLOR_RED, "This vehicle is too damaged !");
if(PlayerInfo[playerid][vVVVModel] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont have vehicle in this slot.");
{
if(PlayerInfo[playerid][vVVVModel])
{
DestroyVehicle(PlayerInfo[playerid][pVVVVeh]);
}
v4spawned[playerid] = 0;
vspawned[playerid] = 0;
format(string, sizeof(string), "You have despawned your %s.", RVN(PlayerInfo[playerid][vVVVModel]));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
}
return 1;
}