06.12.2011, 15:14
Tipo quando uso o cmd para criar os carros eles vem ae quando vo usar o cmd para destruir eles fica falando q so posso destruir carros criados sera q alguem pode me ajudar ae agradeзo.
}
if(strcmp(cmd, "/kray", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 1340)
{
SendClientMessage(playerid, COLOR_GRAD1, " Voce nгo esta autorizado a usar este comando!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 612) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), " Vehicle %d spawned.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
}
if(!strcmp("/destruirid", cmdtext, true))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб autorizado a usar este comando !");
return 1;
}
if(admadministrando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1340)
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/administrar)");
return 1;
}
new counter = 0;
new result;
new plyName[MAX_PLAYER_NAME];
GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
for(new i; i != MAX_VEHICLES; i++)
{
new dist = ChecarveiculoBSF(5, playerid, i);
if(dist)
{
result = i;
counter++;
}
}
switch(counter)
{
case 0:
{
SendClientMessage(playerid, COLOR_GREY, " Nгo hб nenhum carro nesse raio!");
}
case 1:
{
if(result < CAR_AMOUNT)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк sу pode destruir veнculos criados");
return 1;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
DestroyVehicle(result);
format(string, sizeof(string), "Vocк destruiu o veнculo ID:[%d]", result);
SendClientMessage(playerid, COLOR_GREY, string);
if(admadministrando[playerid] == 1 && admhide[playerid] == 1)
{
format(string, sizeof(string), "AdmAviso: Carro ID:[%d] foi destruido Por: Admin_Bot", result);
ABroadCast(COLOR_YELLOW,string,1);
}
else
{
format(string, sizeof(string), "AdmAviso: Carro ID:[%d] foi destruido Por: %s", result, name);
ABroadCast(COLOR_YELLOW,string,1);
}
}
default:
{
SendClientMessage(playerid, COLOR_GREY, " Foram encontrados mais de um carro nesse raio");
}
}
}
return 1;