[AJUDA] Ajuda com o cmd cinto
#1

Galera to com um probleminha!

Tipo eu quero que o player usa um comando sу em tal carro.. tipo
eu quero que ele usa esse comando somente nesses IDs das motos
548, 457, 526, 486, 561
caso ele digitar em um outro veiculo que nгo seja nesses IDS aparece uma menssagem de erro!

nesse codigo:

pawn Код:
if(!strcmp(cmdtext, "/cinto", true))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(CintoPlayer[playerid] == 0)
        {
            CintoPlayer[playerid] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_GREEN,"[AVISO] Parabйns Vocк esta de Cinto, Agora Esta Protegido (/tirarcinto)");
            format(string, sizeof(string), "%s coloca o cinto de seguranзa.", sendername);
            ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк jб estб de cinto.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк nгo estб em um veнculo.");
    }
    return 1;
    }
Reply
#2

pawn Код:
stock IsBike(carid)
{
    new Bikes[] = { 548, 457, 526, 486, 561 };
    for(new i = 0; i < sizeof(Bikes); i++)
    {
        if(GetVehicleModel(carid) == Bikes[i]) return 1;
    }
    return 0; //Coloca no final do GM
}
pawn Код:
if(!strcmp(cmdtext, "/cinto", true))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(!IsBike(GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tб em uma moto"); //Essa й a linha que identifica(Usando a Stock)
        if(CintoPlayer[playerid] == 0)
        {
            CintoPlayer[playerid] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_GREEN,"[AVISO] Parabйns Vocк esta de Cinto, Agora Esta Protegido (/tirarcinto)");
            format(string, sizeof(string), "%s coloca o cinto de seguranзa.", sendername);
            ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк jб estб de cinto.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк nгo estб em um veнculo.");
    }
    return 1;
    }
Reply
#3

Esse sistema nгo funciona.... da erro na hora de compilar!
da erro na stock e no return da menssagem!
alguem aqui sabe como fazer esse sistema
?
Reply
#4

Quais erros, quais linhas.
Usei o IsBike em mais de 5 GM's e em 3 FS, funcionou perfeitamente.
Reply
#5

Mande o erro que lhe aparenta.
Reply
#6

pawn Код:
if(!strcmp(cmdtext, "/cinto", true))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(!IsBike(GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tб em uma moto"); //Essa й a linha que identifica(Usando a Stock)
        if(CintoPlayer[playerid] == 0)
        {
            CintoPlayer[playerid] = 1;
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_GREEN,"[AVISO] Parabйns Vocк esta de Cinto, Agora Esta Protegido (/tirarcinto)");
            format(string, sizeof(string), "%s coloca o cinto de seguranзa.", sendername);
            ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
            SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк jб estб de cinto.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW,"[AVISO] Vocк nгo estб em um veнculo.");
    }
    return 1;
    }
Na linha do !IsBike da esse erro:
C:\Users\EletroHouse\Desktop\Nova pasta (3)\gamemodes\BeC2.PWN(22983) : error 001: expected token: ")", but found "return"
Reply
#7

Substitua esta:

pawn Код:
if(!IsBike(GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tб em uma moto");
por esta:

pawn Код:
if(!IsBike(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tб em uma moto");
O unico erro nesta linha era a falta de um ")" antes do "return".

UMA DICA: Se vocк souber inglкs ajuda um pouco no pawno.
Reply
#8

Tenta assim.

pawn Код:
if(!strcmp(cmdtext, "/cinto", true))
{
 if(CintoPlayer[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк jб estб de cinto!");
 if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo estб em um veнculo!");
 if(!IsBike(GetPlayerVehicleID(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Vocк nгo tб em uma moto");
 if(CintoPlayer[playerid] == 0)
 {
  CintoPlayer[playerid] = 1;
  GetPlayerName(playerid, sendername, sizeof(sendername));
  SendClientMessage(playerid, COLOR_GREEN,"[AVISO] Parabйns Vocк esta de Cinto, Agora Esta Protegido (/tirarcinto)");
  format(string, sizeof(string), "%s coloca o cinto de seguranзa.", sendername);
  ProxDetector(10.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  return 1;
 }
 return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)