[AJUDA] /SetCar bugado -
[RoxX]Ygor - 01.10.2010
Eu achei esse code de setar carro em um GM velho, mais eu puis no meu GM compilou certinho mais quando vou no serevr setar nгo aparece o veiculo nem reiniciando o server, alguem sabe me dizer oque й ?
Comando
pawn Код:
if(strcmp(cmd, "/setcar", true) == 0) {
new tmp[256];
new carid, Float:ang, nome[256], cor1, cor2;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, COLOR_RED, "ID fora do normal | ID's = 400-611");
return 1;
}
carid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/setcar [id] [rotaзгo] [nick] [cor1] [cor2]");
return 1;
}
ang = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/setcar [id] [rotaзгo] [nick] [cor1] [cor2]");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/setcar [id] [rotaзгo] [nick] [cor1] [cor2]");
return 1;
}
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_RED, "/setcar [id] [rotaзгo] [nick] [cor1] [cor2]");
return 1;
}
cor2 = strval(tmp);
if(carid >= 400 && carid <= 611){
if(IsPlayerInAnyVehicle(playerid)){
new File:temp;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "%d %f %f %f %f %d %d //%s\r\n", carid, X, Y, Z, ang, cor1, cor2, nome);
temp = fopen("Veнculos.dm", io_append);
fwrite(temp, string);
fclose(temp);
SendClientMessage(playerid, COLOR_GREEN, "Veнculo setado!");
return 1;
}
else{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo estб em nenhum veнculo e assim e assim nгo pode setar um carro.");
return 1;
}
}
else{
SendClientMessage(playerid, COLOR_RED, "ID fora do normal | ID's = 400-611");
return 1;
}
}
Re: [AJUDA] /SetCar bugado -
Andre_Elite - 01.10.2010
Tenta usar este
pawn Код:
if(strcmp(cmd,"/setcar",true) ==0 || strcmp(cmd,"/car",true)==0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 3)
{
SendClientMessage(playerid, COLOR_GRAD1, " Autorizaзгo insuficiente !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 ou above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 300) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 ou above 300 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /veiculo [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 300) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 ou above 300 !"); 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);
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
format(string, sizeof(string), "Veнculo %d, criado.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}