[Ajuda] Comando de criar veнculo
#1

Code:
pawn Код:
if(strcmp(cmd, "/criarveiculo", true) == 0 || strcmp(cmd, "/cv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 1 || IsPlayerAdmin(playerid)) {

        new plid;
        new Float:X,Float:Y,Float:Z,Float:Angle;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, Vermelho, "* Use: /Criarveiculo [ID do veiculo]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerConnected(playerid)) {
            if(plid >= 400 && plid <= 611) {
                GetPlayerPos(playerid,X,Y,Z);
                GetPlayerFacingAngle(playerid,Angle);
                new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
                PutPlayerInVehicle(playerid,carro,0);
                if(GetPlayerInterior(playerid))
                    LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
                NaoUsado[carro] = true;
                format(string, sizeof(string), "| INFO | Veiculo ID '%d' criado com sucesso.", plid);
                SendClientMessage(playerid, outraadm, string);
                return 1;
            }
            else {
                SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido, digite um ID vбlido. ID's permitidos = 400 б 611.");
                return 1;
            }
        }
    }
}
Queria coloca o comando de deleta veнculos para deleta todos os veнculos criados.
pawn Код:
if(strcmp(cmd, "/dv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new vid;
        vid = GetPlayerVehicleID(playerid);
        if(vid == DPLS[0] || vid == DPLS[1] || vid == DPLS[2] || vid == DPLS[3] || vid == DPLS[4] || vid == DPLS[5] || vid == DPLS[6] || vid == DPLS[7] || vid == DPLS[8] || vid == DPLS[9] || vid == DPLS[10] || vid == DPLS[11] || vid == DPLS[12] || vid == DPLS[13] || vid == DPLS[14]
        || vid == hospcars[0] || vid == hospcars[1] || vid == hospcars[2] || vid == hospcars[3] || vid == hospcars[4] || vid == hospcars[5]) {
            SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
            return 1;
        }
        for(new carro = 0; carro < MAX_CARROS; carro++) {
            format(string, sizeof(string), "carro%d.ini", carro);
            if(vid == dini_Int(string, "Id")) {
                SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
                return 1;
            }
        }
        DestroyVehicle(vid);
        SendClientMessage(playerid,0x0080FFAA,"| INFO | Veiculo deletado com sucesso!");
        return 1;
    }
}
+REP
Reply
#2

pawn Код:
//topo do gm:
new Veiculos[MAX_VEHICLES] = {-1, -1, ...};
new total = -1;

if(!strcmp(cmdtext, "/destruircarros", true))
    {
        if(Veiculos[0] == -1)
        {
            SendClientMessage(playerid, VERMELHO, "[Aviso] Nenhum veнculo.");
            return true;
        }
        for(new x = 0; x <= total; x++)
        {
            DestroyVehicle(Veiculos[x]);
        }
        SendClientMessage(playerid,0xFFFFFFAA,"Todos os Veнculos foram removidos.");
        return true;
    }
Reply
#3

Quote:
Originally Posted by Joker_OutLock
Посмотреть сообщение
pawn Код:
//topo do gm:
new Veiculos[MAX_VEHICLES] = {-1, -1, ...};
new total = -1;

if(!strcmp(cmdtext, "/destruircarros", true))
    {
        if(Veiculos[0] == -1)
        {
            SendClientMessage(playerid, VERMELHO, "[Aviso] Nenhum veнculo.");
            return true;
        }
        for(new x = 0; x <= total; x++)
        {
            DestroyVehicle(Veiculos[x]);
        }
        SendClientMessage(playerid,0xFFFFFFAA,"Todos os Veнculos foram removidos.");
        return true;
    }
Isso aн nгo vai funcionar hein ...
Reply
#4

Eu tambйm qeria alguйm ajuda ae
Reply
#5

Tenta:
pawn Код:
//TOPO DO GAMEMODE
new bool:VC[MAX_VEHICLES];

//COMANDOS
if(strcmp(cmd, "/criarveiculo", true) == 0 || strcmp(cmd, "/cv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 1 || IsPlayerAdmin(playerid)) {

        new plid;
        new Float:X,Float:Y,Float:Z,Float:Angle;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, Vermelho, "* Use: /Criarveiculo [ID do veiculo]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerConnected(playerid)) {
            if(plid >= 400 && plid <= 611) {
                GetPlayerPos(playerid,X,Y,Z);
                GetPlayerFacingAngle(playerid,Angle);
                new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
                VC[carro] = true;
                PutPlayerInVehicle(playerid,carro,0);
                if(GetPlayerInterior(playerid))
                    LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
                NaoUsado[carro] = true;
                format(string, sizeof(string), "| INFO | Veiculo ID '%d' criado com sucesso.", plid);
                SendClientMessage(playerid, outraadm, string);
                return 1;
            }
            else {
                SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido, digite um ID vбlido. ID's permitidos = 400 б 611.");
                return 1;
            }
        }
    }
}

if(strcmp(cmd, "/dv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new vid;
        vid = GetPlayerVehicleID(playerid);
        if(vid == DPLS[0] || vid == DPLS[1] || vid == DPLS[2] || vid == DPLS[3] || vid == DPLS[4] || vid == DPLS[5] || vid == DPLS[6] || vid == DPLS[7] || vid == DPLS[8] || vid == DPLS[9] || vid == DPLS[10] || vid == DPLS[11] || vid == DPLS[12] || vid == DPLS[13] || vid == DPLS[14]
        || vid == hospcars[0] || vid == hospcars[1] || vid == hospcars[2] || vid == hospcars[3] || vid == hospcars[4] || vid == hospcars[5]) {
            SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
            return 1;
        }
        for(new carro = 0; carro < MAX_CARROS; carro++) {
            format(string, sizeof(string), "carro%d.ini", carro);
            if(vid == dini_Int(string, "Id")) {
                SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
                return 1;
            }
        }
        DestroyVehicle(vid);
        SendClientMessage(playerid,0x0080FFAA,"| INFO | Veiculo deletado com sucesso!");
        return 1;
    }
}

if(strcmp(cmd, "/dvall", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        for(new v; v < MAX_VEHICLES; v++)
        {
            if(VC[v] == true) DestroyVehicle(v), VC[v] == false;
        }
        SendClientMessage(playerid,0x0080FFAA,"| INFO | Veiculo deletado com sucesso!");
        return 1;
    }
}
Reply
#6

Deu esses erros

pawn Код:
(5454) : warning 215: expression has no effect
(6545) : error 017: undefined symbol "tmp"
(6546) : error 017: undefined symbol "tmp"
(6550) : error 017: undefined symbol "tmp"
(6561) : error 017: undefined symbol "NaoUsado"
(6561) : warning 215: expression has no effect
(6561) : error 001: expected token: ";", but found "]"
(6561) : error 029: invalid expression, assumed zero
(6561) : fatal error 107: too many error messages on one line
Linha:

pawn Код:
5454 : if(VC[v] == true) DestroyVehicle(v), VC[v] == false;
6545 : tmp = strtok(cmdtext, idx);
6546 : if(!strlen(tmp)) {
6550 : plid = strval(tmp);
6561 : NaoUsado[carro] = true;
Reply
#7

What? Use apenas o meu comando amigo, nгo misture...
Reply
#8

Quote:
Originally Posted by CidadeNovaRP
Посмотреть сообщение
What? Use apenas o meu comando amigo, nгo misture...
to usando й o seu mesmo --'
Reply
#9

Quote:
Originally Posted by 3V3RTON
Посмотреть сообщение
to usando й o seu mesmo --'
Sorry, tenta:
pawn Код:
//TOPO DO GAMEMODE
new bool:VC[MAX_VEHICLES];

//COMANDOS
if(strcmp(cmd, "/criarveiculo", true) == 0 || strcmp(cmd, "/cv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 1 || IsPlayerAdmin(playerid)) {

        new plid;
        new Float:X,Float:Y,Float:Z,Float:Angle;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, Vermelho, "* Use: /Criarveiculo [ID do veiculo]");
            return 1;
        }
        plid = strval(tmp);
        if(IsPlayerConnected(playerid)) {
            if(plid >= 400 && plid <= 611) {
                GetPlayerPos(playerid,X,Y,Z);
                GetPlayerFacingAngle(playerid,Angle);
                new carro = CreateVehicle(plid, X, Y, Z, Angle, -1, -1, 120000);
                VC[carro] = true;
                PutPlayerInVehicle(playerid,carro,0);
                if(GetPlayerInterior(playerid))
                    LinkVehicleToInterior(carro,GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld(playerid));
                format(string, sizeof(string), "| INFO | Veiculo ID '%d' criado com sucesso.", plid);
                SendClientMessage(playerid, outraadm, string);
                return 1;
            }
            else {
                SendClientMessage(playerid, Vermelho, "| ERRO | ID invбlido, digite um ID vбlido. ID's permitidos = 400 б 611.");
                return 1;
            }
        }
    }
}

if(strcmp(cmd, "/dv", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        new vid;
        vid = GetPlayerVehicleID(playerid);
        if(vid == DPLS[0] || vid == DPLS[1] || vid == DPLS[2] || vid == DPLS[3] || vid == DPLS[4] || vid == DPLS[5] || vid == DPLS[6] || vid == DPLS[7] || vid == DPLS[8] || vid == DPLS[9] || vid == DPLS[10] || vid == DPLS[11] || vid == DPLS[12] || vid == DPLS[13] || vid == DPLS[14]
        || vid == hospcars[0] || vid == hospcars[1] || vid == hospcars[2] || vid == hospcars[3] || vid == hospcars[4] || vid == hospcars[5]) {
            SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
            return 1;
        }
        for(new carro = 0; carro < MAX_CARROS; carro++) {
            format(string, sizeof(string), "carro%d.ini", carro);
            if(vid == dini_Int(string, "Id")) {
                SendClientMessage(playerid, Vermelho, "| ERRO | Esse veiculo nгo pode ser deletado!");
                return 1;
            }
        }
        DestroyVehicle(vid);
        SendClientMessage(playerid,0x0080FFAA,"| INFO | Veiculo deletado com sucesso!");
        return 1;
    }
}

if(strcmp(cmd, "/dvall", true) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(pAdmin[playerid] == 5)
    {
        for(new v; v < MAX_VEHICLES; v++)
        {
            if(VC[v] == true) DestroyVehicle(v), VC[v] == false;
        }
        SendClientMessage(playerid,0x0080FFAA,"| INFO | Veiculo deletado com sucesso!");
        return 1;
    }
}
Reply
#10

Primeiro deu esses xD'
pawn Код:
(6505) : error 017: undefined symbol "tmp"
(6506) : error 017: undefined symbol "tmp"
(6510) : error 017: undefined symbol "tmp"
(6568) : warning 215: expression has no effect

6505: tmp = strtok(cmdtext, idx);
6506: if(!strlen(tmp)) {
6510: plid = strval(tmp);
6568: if(VC[v] == true) DestroyVehicle(v), VC[v] == false;
Depois eu coloqei
new tmp[128];

Deus esses :

pawn Код:
(6505) : error 006: must be assigned to an array
(6506) : error 035: argument type mismatch (argument 1)
(6510) : error 035: argument type mismatch (argument 1)
(6505) : warning 204: symbol is assigned a value that is never used: "tmp"
(6568) : warning 215: expression has no effect

6505: tmp = strtok(cmdtext, idx);
6506: if(!strlen(tmp)) {
6510: plid = strval(tmp);
6568: if(VC[v] == true) DestroyVehicle(v), VC[v] == false;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)