if(strcmp(cmd, "/cv", true) == 0){
if(pAdmin[playerid] == 6 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)) {
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Vermelho, "| ERRO | Vocк jб estб em um veiculo");
new plid;
new Float:X,Float:Y,Float:Z,Float:Angle;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "| ERRO | Digite: /Cv [id-do-caro]");
return 1;
}
plid = strval(tmp);
if(plid == 435 || plid == 449 || plid == 450 || plid == 464 || plid == 465 || plid == 501 || plid == 537 || plid == 538 || plid == 564 || plid == 569 || plid == 570
|| plid == 584 || plid == 590 || plid == 591 || plid == 594 || plid == 606 || plid == 607 || plid == 608 || plid == 610 || plid == 611 || plid == 441) {
SendClientMessage(playerid, Vermelho, "| ERRO | Veiculo Proibido!");
return 1;
}
if(IsPlayerConnected(playerid)) {
if(plid >= 400 && plid <= 611) {
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
carroadmin[playerid] = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
SetVehicleNumberPlate(carroadmin[playerid], "Admin");
PutPlayerInVehicle(playerid,carroadmin[playerid],0);
if(GetPlayerInterior(playerid))
LinkVehicleToInterior(carroadmin[playerid],GetPlayerInterior(playerid));
SetVehicleVirtualWorld(carroadmin[playerid],GetPlayerVirtualWorld(playerid));
format(string, sizeof(string), "Vocк criou o veнculo de ID:{FF0000} %d", plid);
SendClientMessage(playerid, ocd, string);
cVehicle[playerid] = true;
}
else {
SendClientMessage(playerid, Vermelho, "| ERRO | Veiculo invбlido | IDs = 400-611");
return 1;
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER){
for(new carro, JFS = sizeof(JFSCarros); carro != JFS; carro++){
if(JFSID[carro] == GetPlayerVehicleID(playerid) && strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], true)){
format(Celulas1, sizeof(Celulas1), "~~>{FFFFFF} Esse veiculo pertкnce ao Jogador(a) {2AC741}%s{FFFFFF}", JFSCarros[carro][JFSDono]);
SendClientMessage(playerid, 0x2AC741FF, Celulas1);
SendClientMessage(playerid, Amarelo1, "| AVISO | Vocк tento/roubar esse veiculo que nгo lhe pertкnce e foi adicionado estrelas de Procurado!");
SetPlayerWantedLevel(playerid, 6);
//RemovePlayerFromVehicle(playerid);
}
if(JFSID[carro] == GetPlayerVehicleID(playerid) && !strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], true)){
SendClientMessage(playerid, 0x2AC741FF, "~~> {FFFFFF}Seja Bem Vindo(a) ao seu Veiculo Concessionбria! Use: /MenuVeiculo");
}
}
}
if(dialogid == 4217)
{
if(response)
{
{
format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
DOF2_RemoveFile(Celulas1);
DOF2_SaveFile();
DestroyVehicle(JFSID[playerid]);
CarroJFS[playerid] = 0;
RemovePlayerFromVehicle(playerid);
format(Celulas1, sizeof(Celulas1), "| INFO | Vocк Vendeu seu veiculo e recebeu {2AC741}$40.000{FFFFFF} de volta!", GranaVenderCarro);
SendClientMessage(playerid, -1, Celulas1);
GivePlayerGrana(playerid, GranaVenderCarro);
}
}
return true;
}
Coloque a variбvel que armazena o ID do veiculo do player no DestroyVehicle.
|
new JFSID[MAX_VEHICLES], PlayerVehicle[MAX_PLAYERS];
/*
Quando player comprar o veiculo pa: PlayerVehicle[playerid] = JFSID[conce];
Quando criar o veiculo na conce pa: JFSID[conce] = CreateVehicle(...);
*/
if(newstate == PLAYER_STATE_DRIVER){
for(new carro = 0; carro < MAX_VEHICLES; carro++){
if(JFSID[carro] != PlayerVehicle[playerid] && strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], false)){
format(Celulas1, sizeof(Celulas1), "~~>{FFFFFF} Esse veiculo pertкnce ao Jogador(a) {2AC741}%s{FFFFFF}", JFSCarros[carro][JFSDono]);
SendClientMessage(playerid, 0x2AC741FF, Celulas1);
SendClientMessage(playerid, Amarelo1, "| AVISO | Vocк tento/roubar esse veiculo que nгo lhe pertкnce e foi adicionado estrelas de Procurado!");
SetPlayerWantedLevel(playerid, 6);
}
if(JFSID[carro] == PlayerVehicle[playerid] && !strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], false)){
SendClientMessage(playerid, 0x2AC741FF, "~~> {FFFFFF}Seja Bem Vindo(a) ao seu Veiculo Concessionбria! Use: /MenuVeiculo");
}
}
}
if(dialogid == 4217)
{
if(response)
{
{
format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
DOF2_RemoveFile(Celulas1);
DOF2_SaveFile();
DestroyVehicle(PlayerVehicle[playerid]);
format(JFSCarros[PlayerVehicle[playerid]][JFSDono], sizeof(JFSCarros[PlayerVehicle[playerid]][JFSDono]), "Nenhum");
JFSID[PlayerVehicle[playerid]] = 0;
CarroJFS[playerid] = 0;
RemovePlayerFromVehicle(playerid);
format(Celulas1, sizeof(Celulas1), "| INFO | Vocк Vendeu seu veiculo e recebeu {2AC741}$40.000{FFFFFF} de volta!", GranaVenderCarro);
SendClientMessage(playerid, -1, Celulas1);
GivePlayerGrana(playerid, GranaVenderCarro);
}
}
return true;
}