Me ajudem bug ao vender carro -
lokos45 - 03.08.2013
Olб pessoal, preciso da ajuda de vcs pois no GM ao se vender um carro tem um grande bug, irei mostrar nas screenshoots a seguir:
Observem aqui que eu comprei 3 carros e seus respectivos IDs estгo no meu /rg:
Agora observem, irei vender o ъltimo carro do meu /rg, dei /carid pra vcs conferirem (Carro ID: 758 ):
Agora, observem que apуs ao vender o carro, o ID dele(758 ), nгo saiu do meu /rg, e sim o primeiro carro(761), e para fazer o carro 758 sumir do meu /rg teria que vendк-lo 3 vezes, tendo que obrigatoriamente, fazer os IDs 761 e 760 sumirem tambйm, e eu nгo quero isso :/
Apуs vender o carro ID 758 1 vez:
Apуs vender o carro ID 758 2 vezes:
Apуs vender o carro ID 758 3 vezes:
Eu nгo queria que isso acontecesse, queria que o carro que fosse vendido, seu ID respectivo saнsse do /rg, e nгo os primeiros. Poderiam me ajudar por favor? Aqui vai o cуdigo do /veiculo vender :
Код:
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 true;
}
if(PlayerInfo[playerid][pCarKey] != vehid && PlayerInfo[playerid][pCarKey2] != vehid && PlayerInfo[playerid][pCarKey3] != vehid)
{
SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo]][cOwner], true) == 0)
{
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);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey] = 0;
PlayerInfo[playerid][pVeiculo] = 0;
SaveCars();
return true;
}
else if(PlayerInfo[playerid][pCarKey2] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo2]][cOwner], true) == 0)
{
new car2 = PlayerInfo[playerid][pVeiculo2];
CarInfo[car2][cOwned] = 0;
CarInfo[car2][cModel] = 560;
CarInfo[car2][cColorOne] = 0;
CarInfo[car2][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car2][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car2][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car2][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey2] = 0;
PlayerInfo[playerid][pVeiculo2] = 0;
SaveCars();
return true;
}
else if(PlayerInfo[playerid][pCarKey3] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo3]][cOwner], true) == 0)
{
new car3 = PlayerInfo[playerid][pVeiculo3];
CarInfo[car3][cOwned] = 0;
CarInfo[car3][cModel] = 560;
CarInfo[car3][cColorOne] = 0;
CarInfo[car3][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car3][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car3][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car3][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey3] = 0;
PlayerInfo[playerid][pVeiculo3] = 0;
SaveCars();
return true;
}
}
return true;
}
Respuesta: Me ajudem bug ao vender carro -
ViniKuliveguisky - 03.08.2013
Tenta alguma coisa assim
pawn Код:
if(strcmp(tmp, "vender1", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem um Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey] != vehid)
{
SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo]][cOwner], true) == 0)
{
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);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey] = 0;
PlayerInfo[playerid][pVeiculo] = 0;
SaveCars();
return 1;
}
}
return 1;
}
if(strcmp(tmp, "vender2", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey2] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem um Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey2] != vehid)
{
SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey2] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo2]][cOwner], true) == 0)
{
new car2 = PlayerInfo[playerid][pVeiculo2];
CarInfo[car2][cOwned] = 0;
CarInfo[car2][cModel] = 560;
CarInfo[car2][cColorOne] = 0;
CarInfo[car2][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car2][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car2][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car2][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey2] = 0;
PlayerInfo[playerid][pVeiculo2] = 0;
SaveCars();
return 1;
}
}
return 1;
}
if(strcmp(tmp, "vender3", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerInfo[playerid][pCarKey3] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem um Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey3] != vehid)
{
SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
return true;
}
if(PlayerInfo[playerid][pCarKey3] != 0 && strcmp(playername, CarInfo[PlayerInfo[playerid][pVeiculo3]][cOwner], true) == 0)
{
new car3 = PlayerInfo[playerid][pVeiculo3];
CarInfo[car3][cOwned] = 0;
CarInfo[car3][cModel] = 560;
CarInfo[car3][cColorOne] = 0;
CarInfo[car3][cColorTwo] = 0;
GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(CarInfo[car3][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerMoney(playerid,CarInfo[car3][cValue]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~Carro Vip Vendido Por: ~n~~g~$%d", CarInfo[car3][cValue]);
GameTextForPlayer(playerid, string, 10000, 3);
RemovePlayerFromVehicleEx(playerid);
Controle(playerid, 1);
PlayerInfo[playerid][pCarKey3] = 0;
PlayerInfo[playerid][pVeiculo3] = 0;
SaveCars();
return true;
}
}
return true;
}
Re: Me ajudem bug ao vender carro -
lokos45 - 03.08.2013
Funcionou mano, obrigado, mas eu queria que fosse com apenas 1 comando para nгo ficar complicado, tem como?