[Ajuda] Criar Um Comando /cv
#1

Como criar um comando de cria um veiculo temporario . quando o player sai do carro ele some ou fica ate cria outro um bem simples ? /cv mais tem que ser pelo

if(strcmp(cmdtext, "/cv", true) == 0)

Para Dar certo no meu gm """""
Reply
#2

pawn Code:
// Topo do GM

new VeiculoPlayer[MAX_PLAYERS];

// OnPlayerUpdate

if(VeiculoPlayer[playerid])
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        OnPlayerCommandText(playerid,"/dcv");
    }
}

// Comando

if(strcmp(cmd, "/cv", true) == 0)
{
    if(VeiculoPlayer[playerid] >= 1)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
        return 1;
    }
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp))
    {
        SendClientMessageEx(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
        return 1;
    }
    new car = strval(tmp);

    if(car < 400 || car > 611)
    {
        SendClientMessageEx(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

    VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
    return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
    if(VeiculoPlayer[playerid] == 0)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Vocк nгo criou um veнculo!");
        return 1;
    }
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veнculo Foi destruнdo!");

    DestroyVehicle(VeiculoPlayer[playerid]);
    VeiculoPlayer[playerid] = 0;

    return 1;
}
Reply
#3

biel mais isso encaixa no meu server cmdtext?
Reply
#4

Sim
Reply
#5

erro !
Reply
#6

Qual erro ?
Reply
#7

Tae !
Quote:

C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(545) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(553) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(553) : error 017: undefined symbol "idx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(555) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(557) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(561) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(565) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(575) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.

Reply
#8

pawn Code:
new cmd[128],tmp[128],idx; cmd = strtok(cmdtext,idx);

if(strcmp(cmd, "/cv", true) == 0)
{
    if(VeiculoPlayer[playerid] >= 1)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
        return 1;
    }
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
        return 1;
    }
    new car = strval(tmp);

    if(car < 400 || car > 611)
    {
        SendClientMessage(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

    VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
    return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
    if(VeiculoPlayer[playerid] == 0)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Vocк nгo criou um veнculo!");
        return 1;
    }
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veнculo Foi destruнdo!");

    DestroyVehicle(VeiculoPlayer[playerid]);
    VeiculoPlayer[playerid] = 0;

    return 1;
}
Reply
#9

Ops Quassee Bieeell
Quote:

C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(545) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(554) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Linha 545

Quote:

new cmd[128],tmp[128],idx; cmd = strtok(cmdtext,idx);

Linha 554

Quote:

tmp = strtok(cmdtext,idx);

Reply
#10

pawn Code:
new cmd[168];
new tmp[168];
new idx;

cmd = strtok(cmdtext,idx);

if(strcmp(cmd, "/cv", true) == 0)
{
    if(VeiculoPlayer[playerid] >= 1)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
        return 1;
    }
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
        return 1;
    }
    new car = strval(tmp);

    if(car < 400 || car > 611)
    {
        SendClientMessage(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

    VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
    return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
    if(VeiculoPlayer[playerid] == 0)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Vocк nгo criou um veнculo!");
        return 1;
    }
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veнculo Foi destruнdo!");

    DestroyVehicle(VeiculoPlayer[playerid]);
    VeiculoPlayer[playerid] = 0;

    return 1;
}

// Fim do gm

strtok(const string[], &index)
{
    new length = strlen(string);

    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];

    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)