I'm not having issues with the buy car.. i'm having issues detecting if the player is in there car, but here
pawn Код:
CMD:buycar(playerid,params[])
{
if(CARSPAWNED[playerid] == 1) return SendClientMessage(playerid,-1,EMBED_RED"[ERROR]: You must have your car despawned before purchasing a new one!");
new car = GetPlayerVehicleID(playerid);
if(car == dealercar[0])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"hotring"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 494;
PlayerInfo[playerid][Money] -= 120000;
CreateVehicle(494,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[1])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"cheetah"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 415;
PlayerInfo[playerid][Money] -= 90000;
CreateVehicle(415,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[2])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"banshee"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 429;
PlayerInfo[playerid][Money] -= 100000;
CreateVehicle(429,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[3])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"bullet"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 541;
PlayerInfo[playerid][Money] -= 105000;
CreateVehicle(541,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[4])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"buffalo"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 402;
PlayerInfo[playerid][Money] -= 92000;
CreateVehicle(402,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[5])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"ZR-350"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 477;
PlayerInfo[playerid][Money] -= 85000;
CreateVehicle(477,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[6])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"windsor"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 555;
PlayerInfo[playerid][Money] -= 250000;
CreateVehicle(555,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[7])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"FCR-900"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 521;
PlayerInfo[playerid][Money] -= 75000;
CreateVehicle(521,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[8])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"NRG-900"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 522;
PlayerInfo[playerid][Money] -= 98000;
CreateVehicle(522,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[9])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"freeway"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 463;
PlayerInfo[playerid][Money] -= 75000;
CreateVehicle(463,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[10])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"wayfarer"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 486;
PlayerInfo[playerid][Money] -= 43000;
CreateVehicle(486,-1969.5432,258.5425,34.7968,358.2475,0,0,99999);
}
if(car == dealercar[11])
{
SendClientMessage(playerid,-1,EMBED_CYAN"[DEALERSHIP]: "EMBED_WHITE"You've purchased a "EMBED_GREEN"PCJ-600"EMBED_WHITE".");
PlayerInfo[playerid][Vehicle] = 461;
PlayerInfo[playerid][Money] -= 88000;
CreateVehicle(461,-1969.5432,258.5425,34.7968,358.2475,0,0,999999);
}
CARSPAWNED[playerid] = 1;
RemovePlayerFromVehicle(playerid);
SetTimer("Unfreeze",1500,0);
return 1;
}