[Ajuda] Destruir carros
#1

Nгo sei como destruir os carros criados pelo comando de admin,queria que alguem me ajuda-se nisso ou ajuda-se a quando o admin descer do veiculo ele sumir!
OBS: O comando que quero й aquele /destruircarros que destroi todos os carros criados e nгo apenas 1.

CMD:
Quote:

if(strcmp(cmd, "/cv", true) == 0)
{
if(pAdmin[playerid] == 5 ) {
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==501 || plid==465 || plid==464 || plid==594 || plid==564 || plid==427 || plid==501) {
SendClientMessage(playerid, Vermelho, " | ERRO | ID de carro Proibido!");
return 1;
}
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(play erid));
SetVehicleVirtualWorld(carro,GetPlayerVirtualWorld (playerid));
format(string, sizeof(string), " | INFO | Vocк criou o veнculo de id: %d", plid);
SendClientMessage(playerid, ocd, string);
return 1;
}
else {
SendClientMessage(playerid, Vermelho, " | ERRO | ID invбlido | ID's = 400-611");
return 1;
}
}
}
}

Reply
#2

GetPlayerVehicleID
DestroyVehicle
Exemplo:
pawn Код:
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
Reply
#3

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
GetPlayerVehicleID
DestroyVehicle
Exemplo:
pawn Код:
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
Eu quero para destruir todos os carros que foram criados pelo comando de admin /cv
Reply
#4

Quote:
Originally Posted by logan1910
Посмотреть сообщение
Eu quero para destruir todos os carros que foram criados pelo comando de admin /cv

DestroyVehicle


sу trocar o vehicleid,pela sua variavel que geta o id dos carros criados pelos admins.
Reply
#5

Quote:
Originally Posted by TioSlash
Посмотреть сообщение

DestroyVehicle


sу trocar o vehicleid,pela sua variavel que geta o id dos carros criados pelos admins.
E como vou saber a variavel '-'-'-' kkk
Reply
#6

Vocк terб que usar uma loop, e variбveis.
pawn Код:
new PlayerCv[500];
new CarPlayerID[500];
pawn Код:
if(strcmp(cmd, "/cv", true) == 0)
{
PlayerCv[playerid] = 1;
CarPlayerID[playerid] = CreateVehicle(522, 0.0, 0.0, 0.0, 0.0, -1, -1, 120000);
return 1;
}
if(strcmp(cmd, "/destruircarro", true) == 0)
{
    for(new i=0; i<500; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerCv[i] == 1)
            {
                if(GetPlayerVehicleID(playerid) == CarPlayerID[i])
                {
                    DestroyVehicle(GetPlayerVehicleID(playerid));
                    PlayerCv[i] = 0;
                    CarPlayerID[i] = 0;
                }
                else
                {
                    SendClientMessage(playerid, -1, "Vocк nгo estб em um veнculo criado pelo comando /cv");
                }
            }
        }
    }
}
Use a funзгo IsPlayerInAnyVehicle para ver se o player estб em algum veнculo no comando /destruirveiculo
Reply
#7

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Vocк terб que usar uma loop, e variбveis.
pawn Код:
new PlayerCv[500];
new CarPlayerID[500];
pawn Код:
if(strcmp(cmd, "/cv", true) == 0)
{
PlayerCv[playerid] = 1;
CarPlayerID[playerid] = CreateVehicle(522, 0.0, 0.0, 0.0, 0.0, -1, -1, 120000);
return 1;
}
if(strcmp(cmd, "/destruircarro", true) == 0)
{
    for(new i=0; i<500; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerCv[i] == 1)
            {
                if(GetPlayerVehicleID(playerid) == CarPlayerID[i])
                {
                    DestroyVehicle(GetPlayerVehicleID(playerid));
                    PlayerCv[i] = 0;
                    CarPlayerID[i] = 0;
                }
                else
                {
                    SendClientMessage(playerid, -1, "Vocк nгo estб em um veнculo criado pelo comando /cv");
                }
            }
        }
    }
}
Use a funзгo IsPlayerInAnyVehicle para ver se o player estб em algum veнculo no comando /destruirveiculo
Quote:

C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(804) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(807) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(820) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(833) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(846) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(859) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(871) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(884) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(897) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(911) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(924) : error 010: invalid function or declaration
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3102) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3115) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3931) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3931) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3932) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3934) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(5899) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(13801) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(13825) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(1383 : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14640) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14642) : error 017: undefined symbol "PlayerCv"
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14642) : warning 215: expression has no effect
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14642) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14642) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14642) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


15 Errors.

Eu quero um comando que destrua todos os carros e nгo apenas o que eu criei!
Reply
#8

O comando que eu te mostrei deleta os veнculos, que forem criados pelo comando /cv, eu entro em um veiculo, e do /destruirveiculo ele vai verificar se o veiculo foi criado pelo comando cv.
Em questгo dos erro eu esqueci de retornar a verdadeiro o comando.
Coloque no topo do GM:
pawn Код:
new PlayerCv[500];
pawn Код:
if(strcmp(cmd, "/destruircarro", true) == 0)
{
    for(new i=0; i<500; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerCv[i] == 1)
            {
                if(GetPlayerVehicleID(playerid) == CarPlayerID[i])
                {
                    DestroyVehicle(GetPlayerVehicleID(playerid));
                    PlayerCv[i] = 0;
                    CarPlayerID[i] = 0;
                }
                else
                {
                    SendClientMessage(playerid, -1, "Vocк nгo estб em um veнculo criado pelo comando /cv");
                }
            }
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
O comando que eu te mostrei deleta os veнculos, que forem criados pelo comando /cv, eu entro em um veiculo, e do /destruirveiculo ele vai verificar se o veiculo foi criado pelo comando cv.
Em questгo dos erro eu esqueci de retornar a verdadeiro o comando.
Coloque no topo do GM:
pawn Код:
new PlayerCv[500];
pawn Код:
if(strcmp(cmd, "/destruircarro", true) == 0)
{
    for(new i=0; i<500; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerCv[i] == 1)
            {
                if(GetPlayerVehicleID(playerid) == CarPlayerID[i])
                {
                    DestroyVehicle(GetPlayerVehicleID(playerid));
                    PlayerCv[i] = 0;
                    CarPlayerID[i] = 0;
                }
                else
                {
                    SendClientMessage(playerid, -1, "Vocк nгo estб em um veнculo criado pelo comando /cv");
                }
            }
        }
    }
    return 1;
}
Deu erro man =|


Quote:

C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(804) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(806) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(819) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(832) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(845) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(85 : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(870) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(883) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(896) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(910) : error 055: start of function body without function header
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(923) : error 010: invalid function or declaration
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3101) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3114) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3930) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3930) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3931) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(3933) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(589 : warning 202: number of arguments does not match definition
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(13800) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(13824) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(13837) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14639) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14645) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14649) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14675) : warning 217: loose indentation
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : error 017: undefined symbol "PlayerCv"
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : warning 215: expression has no effect
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


15 Errors.

Reply
#10

pawn Код:
C:\Users\Administrator\Downloads\PARTE 1\GM\GM\gamemodes\BVR.pwn(14681) : error 017: undefined symbol "PlayerCv"
Coloque no topo do GM:
pawn Код:
new PlayerCv[MAX_PLAYERS];
Envie as linhas do outros erro para que eu possa te ajudar.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)