pawn Код:
if(strcmp(tmp, "vender", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey] == 0 && PlayerInfo[playerid][pCarKey2] == 0 && PlayerInfo[playerid][pCarKey3] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem um Carro VIP.");
return 1;
}
if(PlayerInfo[playerid][pCarKey] != vehid && PlayerInfo[playerid][pCarKey2] != vehid && PlayerInfo[playerid][pCarKey3] != vehid)
{
SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
return 1;
}
if(PlayerInfo[playerid][pCarKey] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo]][cOwner], true) == 0)
{
new rand;
new car = PlayerInfo[playerid][pVeiculo];
CarInfo[car][cOwned] = 0;
CarInfo[car][cModel] = 560;
CarInfo[car][cColorOne] = 0;
CarInfo[car][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
TogglePlayerControllable(playerid, 1);
PlayerInfo[playerid][pCarKey] = 0;
PlayerInfo[playerid][pVeiculo] = 0;
rand = random(sizeof(gRandomCarsSpawns));
CarInfo[car][cLocationx] = gRandomCarsSpawns[rand][0];
CarInfo[car][cLocationy] = gRandomCarsSpawns[rand][1];
CarInfo[car][cLocationz] = gRandomCarsSpawns[rand][2];
CarInfo[car][cAngle] = gRandomCarsSpawns[rand][3];
SaveCars();
return 1;
}
else if(PlayerInfo[playerid][pCarKey2] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo2]][cOwner], true) == 0)
{
new rand;
new car = PlayerInfo[playerid][pVeiculo2];
CarInfo[car][cOwned] = 0;
CarInfo[car][cModel] = 560;
CarInfo[car][cColorOne] = 0;
CarInfo[car][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
TogglePlayerControllable(playerid, 1);
PlayerInfo[playerid][pCarKey2] = 0;
PlayerInfo[playerid][pVeiculo2] = 0;
rand = random(sizeof(gRandomCarsSpawns));
CarInfo[car][cLocationx] = gRandomCarsSpawns[rand][0];
CarInfo[car][cLocationy] = gRandomCarsSpawns[rand][1];
CarInfo[car][cLocationz] = gRandomCarsSpawns[rand][2];
CarInfo[car][cAngle] = gRandomCarsSpawns[rand][3];
SaveCars();
return 1;
}
else if(PlayerInfo[playerid][pCarKey3] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo3]][cOwner], true) == 0)
{
new rand;
new car = PlayerInfo[playerid][pVeiculo3];
CarInfo[car][cOwned] = 0;
CarInfo[car][cModel] = 560;
CarInfo[car][cColorOne] = 0;
CarInfo[car][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
TogglePlayerControllable(playerid, 1);
PlayerInfo[playerid][pCarKey3] = 0;
PlayerInfo[playerid][pVeiculo3] = 0;
rand = random(sizeof(gRandomCarsSpawns));
CarInfo[car][cLocationx] = gRandomCarsSpawns[rand][0];
CarInfo[car][cLocationy] = gRandomCarsSpawns[rand][1];
CarInfo[car][cLocationz] = gRandomCarsSpawns[rand][2];
CarInfo[car][cAngle] = gRandomCarsSpawns[rand][3];
SaveCars();
return 1;
}
}
return 1;
}