[DUVIDA]Comandos
#1

pawn Код:
if(strcmp(cmd, "/an", true) == 0)
    {
    new string[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result)) return SendClientMessage(playerid, COR_BRANCO, "Use: /an [Texto]");
        format(string, sizeof(string), "[Anuncio] %s: %s",sendername,result);
        SendClientMessageToAll(COR_AMARELO, string);
        GivePlayerMoney(playerid,-100);
        return 1;
    }

//-------------------------[akill]----------------------------------------------
    if(strcmp(cmd, "/matar", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    new otherplayer = strval(tmp);
    if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /matar [playerid]");
    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID ERRADO]");
        SetPlayerHealth(otherplayer, 0);
   }
   return 1;
    }
Oque tem de Errado nesses cmds ? , Pois eu logo na Rcon e vou digitando os Comandos fica Tudo Embaralhado , Tudo Estranho , Eu uso um Aparece Outro , Usa e nao aparece , Nao sгo sу esses comandos esses sao apenas alguns do conjunto !
Reply
#2

meus comandos sao assim ...

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     new string[256];
    new string1[256];
    new playermoney;
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new playername[MAX_PLAYER_NAME];
    new cmd[256];
    new tmp[256];
    new giveplayerid, moneys, idx;
    new idcar = GetPlayerVehicleID(playerid);
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    cmd = strtok(cmdtext, idx);
    //---------------------------CONCE------------------------------------------
    if(strcmp(cmd, "/anuncio", true) == 0 || strcmp(cmd, "/an", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(gPlayerLogged[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_GREY, "  Vocк precisa se logar primeiro !");
          return 1;
        }
        if(PlayerInfo[playerid][pLevel] < 2)
        {
          SendClientMessage(playerid, COLOR_GREY, "  Vocк precisa ter nнvel 2 para usar essa funзгo !");
          return 1;
        }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: (/an)uncio [texto]");
                return 1;
            }
            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "  Por favor, tente novamente mais tarde, espere %d segundos entre os anъncios !", (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
        {
          format(string, sizeof(string), "* Vocк usou %d caracteres que custam $%d, vocк nгo tem dinheiro suficiente.", offset, payout);
          SendClientMessage(playerid, COLOR_WHITE, string);
          return 1;
        }
            SafeGivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "Anъncio: %s, Contato: %s Tel: %d",result, sendername, PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Pagou $%d~n~~w~O Anъncio contйm: %d caracteres", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
        }
        return 1;
    }
    {
tenta fazer nesse estilo ... pode ser isso ._.
Reply
#3

O Meu Estб Assim

pawn Код:
//----------------------------[/v]----------------------------------------------
    if(strcmp(cmd, "/v", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];

    tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /v [carid] [cor1] [cor2]");
        new car;
        car = strval(tmp);
        if(car < 400 || car > 611) { SendClientMessage(playerid, COR_BRANCO, "O id do veiculo tem que ser entre 400 e 611!"); return 1; }
        tmp = strtok(cmdtext, idx);
        new color1;
        color1 = strval(tmp);
        if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COR_BRANCO, "O id da cor й entre 0 e 126!"); return 1; }
        tmp = strtok(cmdtext, idx);
        new color2;
        color2 = strval(tmp);
        if(color2 < 0 || color2 > 126) return SendClientMessage(playerid, COR_BRANCO, "O id da cor й entre 0 e 126!");
        new Float:X,Float:Y,Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        CreateVehicle(car, X,Y+2,Z, 0.0, color1, color2, 1500000);
        SetVehicleVirtualWorld(car, GetPlayerVirtualWorld(playerid));
        LinkVehicleToInterior(car, GetPlayerInterior(playerid));
   }
   return 1;
    }

//-------------------------------[SETHP]----------------------------------------
    if(strcmp(cmd, "/darvida", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
      new tmp2[256];
      tmp = strtok(cmdtext, idx);
        new otherplayer = ReturnUser(tmp);
        tmp2 = strtok(cmdtext, idx);
        new hp = strval(tmp2);
        if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /setarhp [playerid] [quantidade]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COR_BRANCO, "USO: /setarhp [playerid] [quantidade]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID INVALIDO]");
      SetPlayerHealth(otherplayer, hp);
   }
   return 1;
    }
//------------------------------[SETCOLETE]--------------------------------------
  if(strcmp(cmd, "/darcolete", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
      new tmp2[256];
      tmp = strtok(cmdtext, idx);
        new otherplayer = ReturnUser(tmp);
        tmp2 = strtok(cmdtext, idx);
        new hp = strval(tmp2);
        if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /darcolete [playerid] [quantidade]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COR_BRANCO, "USAGE: /darcolete [playerid] [quantidade]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID INVALIDO]");
        SetPlayerArmour(otherplayer, hp);
   }
   return 1;
    }

//-----------------------[Dar Dinheiro]-------------------------------------------
  if(strcmp(cmd, "/dardinheiro", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new string[256];
    new tmp[256];
    new tmp2[256];
        tmp = strtok(cmdtext, idx);
        new otherplayer = strval(tmp);
        tmp2 = strtok(cmdtext, idx);
        new money = strval(tmp2);
        if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /dardinheiro [playerid] [quantidade]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COR_BRANCO, "USO: /dardinheiro [playerid] [quantidade]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID INVALIDO]");
      GivePlayerMoney(otherplayer, money);
      GetPlayerName(playerid, sendername, sizeof(sendername));
      format(string, sizeof(string), "O Administrador \"%s\" Lhe Deu: %d Reais", sendername, money);
      SendClientMessage(otherplayer, COR_VERDE, string);
   }
   return 1;
    }

//----------------------------[Set Skin]----------------------------------------
    if(strcmp(cmd, "/setarskin", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
    new tmp2[256];
    tmp = strtok(cmdtext, idx);
    new otherplayer = strval(tmp);
    tmp2 = strtok(cmdtext, idx);
    new skin = strval(tmp2);
    if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /setarskin [playerid] [SkinId]");
        if(!strlen(tmp2)) return SendClientMessage(playerid, COR_BRANCO, "USO: /setarskin [playerid] [SkinId]");
        if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID INVALIDO]");
        SetPlayerSkin(otherplayer, skin);
        SendClientMessage(otherplayer, COR_BRANCO, "Um Admin Mudou Sua Skin .");
   }
   return 1;
    }

//-----------------------------[Say]--------------------------------------------
    if(strcmp(cmd, "/av", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new string[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result)) return SendClientMessage(playerid, COR_AMARELO, "USO: /av [Texto]");
        format(string, sizeof(string), "[Anuncio Do Administrador] %s: %s",sendername,result);
        SendClientMessageToAll(ROSA, string);
   }
   return 1;
    }

//----------------------------[/an]----------------------------------------------

    if(strcmp(cmd, "/an", true) == 0)
    {
    new string[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result)) return SendClientMessage(playerid, COR_BRANCO, "Use: /an [Texto]");
        format(string, sizeof(string), "[Anuncio] %s: %s",sendername,result);
        SendClientMessageToAll(COR_AMARELO, string);
        GivePlayerMoney(playerid,-100);
        return 1;
    }

//-------------------------[akill]----------------------------------------------
    if(strcmp(cmd, "/matar", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    new otherplayer = strval(tmp);
    if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /matar [playerid]");
    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID ERRADO]");
        SetPlayerHealth(otherplayer, 0);
   }
   return 1;
    }
Tenho que Conseguir Arrumar Isso !
Reply
#4

Quote:
Originally Posted by hudsonramos10
pawn Код:
if(strcmp(cmd, "/an", true) == 0)
    {
    new string[256];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result)) return SendClientMessage(playerid, COR_BRANCO, "Use: /an [Texto]");
        format(string, sizeof(string), "[Anuncio] %s: %s",sendername,result);
        SendClientMessageToAll(COR_AMARELO, string);
        GivePlayerMoney(playerid,-100);
        return 1;
    }

//-------------------------[akill]----------------------------------------------
    if(strcmp(cmd, "/matar", true) == 0)
    {
   if(IsPlayerAdmin(playerid))
   {
    new tmp[256];
    tmp = strtok(cmdtext, idx);
    new otherplayer = strval(tmp);
    if(!strlen(tmp)) return SendClientMessage(playerid, COR_BRANCO, "USO: /matar [playerid]");
    if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COR_BRANCO, "[ID ERRADO]");
        SetPlayerHealth(otherplayer, 0);
   }
   return 1;
    }
Oque tem de Errado nesses cmds ? , Pois eu logo na Rcon e vou digitando os Comandos fica Tudo Embaralhado , Tudo Estranho , Eu uso um Aparece Outro , Usa e nao aparece , Nao sгo sу esses comandos esses sao apenas alguns do conjunto !
nгo intendi muito bem o seu bug...
vocк usa um comando e acontece outro ?
Reply
#5

erro no id vei
Reply
#6

Quote:
Originally Posted by OWNEDBYSERGIO:.
erro no id vei
q ID ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)