[Ajuda] Comando Com Espaзo + Sscanf (ZCMD)
#10

Код:
CMD:aluguel(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, 0xBFC0C2FF, "USE: /aluguel [ativar/desativar/preco]");
    new alug,
    house = GetProxHouse(playerid),
    Float: X, Float: Y, Float: Z;
    GetPlayerPos(playerid, X, Y, Z);

    if(IsPlayerInRangeOfPoint(playerid, 1, houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
    {
        if(strfind(params, "desativar", true) != -1)
        {
              if(houseData[house][houseRentable] == 0)
             {
                   SendClientMessage(playerid, COLOR_ERROR, "* O aluguel da sua casa jб estб desativado!");
                  PlayerPlaySound(playerid, 1085, X, Y, Z);
                   return 1;
               }

            /*if(strcmp(houseData[house][houseTenant], "Ninguem", false))
               {
                  GetPlayerPos(playerid, X, Y, Z);
                  PlayerPlaySound(playerid, 1085, X, Y, Z);
                 SendClientMessage(playerid, COLOR_ERROR, "* Nгo й possнvel desativar o aluguel com alguйm alugando sua casa.");
                   TogglePlayerControllable(playerid, 1);
                 return 1;
            }*/

            houseData[house][houseRentable] = 0;
               Update3DText(house);
              SendClientMessage(playerid, COLOR_SUCCESS, "* Aluguel desativado com sucesso.");
           }
        else if(strfind(params, "ativar", true) != -1)
        {
              if(houseData[house][houseRentable] == 1)
            {
                   SendClientMessage(playerid, COLOR_ERROR, "* O aluguel da sua casa jб estб ativado!");
                   PlayerPlaySound(playerid, 1085, X, Y, Z);
                  return 1;
               }
            houseData[house][houseRentable] = 1;

            Update3DText(house);
            SendClientMessage(playerid, COLOR_SUCCESS, "* Aluguel ativado com sucesso.");
           }
        else if(strfind(params, "preco", true) != -1)
        {
            if(sscanf(params[6], "d", alug))
            {
                SendClientMessage(playerid, 0xBFC0C2FF, "USE: /aluguel preco [valor]");
                return true;
            }
            if(alug < 1 || alug > 900)
            {
                SendClientMessage(playerid, 0xBFC0C2FF, "Preзo Mнnimo $1, Mбximo R$900.");
                return true;
            }
            new string[128];
            houseData[house][houseRentPrice] = alug;
              Update3DText(house);
            format(string, sizeof(string), "Aluguel definido para: $%d", houseData[house][houseRentPrice]);
            SendClientMessage(playerid, 0xFFFFFFFF, string);
        }
        else SendClientMessage(playerid, 0xBFC0C2FF, "USE: /aluguel [ativar/desativar/preco]");
    }
    else SendClientMessage(playerid, 0xBFC0C2FF, "ERRO: Vocк nгo estб perto da casa");
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)