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

E aн galera, й o seguinte, criei um comando cujo tem 3 funзгo: /aluguel desativar /aluguel ativar e /aluguel preco

Ai estб o comando:
PHP код:
CMD:aluguel(playeridparams[])
{
    new 
alug,
    
house GetProxHouse(playerid),
    
FloatXFloatYFloatZ;
    
GetPlayerPos(playeridXYZ);
    if(
IsPlayerInRangeOfPoint(playerid1houseData[house][houseX], houseData[house][houseY], houseData[house][houseZ]))
    {
        if(!
strcmp(params"desativar"true))
        {
              if(
houseData[house][houseRentable] == 0)
             {
                   
SendClientMessage(playeridCOLOR_ERROR"* O aluguel da sua casa jб estб desativado!");
                  
PlayerPlaySound(playerid1085XYZ);
                   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(playeridCOLOR_SUCCESS"* Aluguel desativado com sucesso.");
           }
        if(!
strcmp(params"ativar"true))
        {
              if(
houseData[house][houseRentable] == 1)
            {
                   
SendClientMessage(playeridCOLOR_ERROR"* O aluguel da sua casa jб estб ativado!");
                   
PlayerPlaySound(playerid1085XYZ);
                  return 
1;
               }
            
houseData[house][houseRentable] = 1;
            
            
Update3DText(house);
            
SendClientMessage(playeridCOLOR_SUCCESS"* Aluguel ativado com sucesso.");
           }
        if(!
strcmp(params"preco"true))
        {
            if(
sscanf(params"d"alug))
            {
                
SendClientMessage(playerid0xBFC0C2FF"USE: /aluguel preco [valor]");
                return 
true;
            }
            if(
alug || alug 900)
            {
                
SendClientMessage(playerid0xBFC0C2FF"Preзo Mнnimo $1, Mбximo R$900.");
                return 
true;
            }
            new 
string[128];
            
houseData[house][houseRentPrice] = alug;
              
Update3DText(house);
            
format(stringsizeof(string), "Aluguel definido para: $%d"houseData[house][houseRentPrice]);
            
SendClientMessage(playerid0xFFFFFFFFstring);
        }
    }
    return 
1;

Estб funcionando de boas, pelo menos os 2 primeiros, desativar e ativar, porйm o preзo nгo estб dando, tipo, eu digito /aluguel preco [valor] e nгo vai, acho que estou fazendo alguma coisa errada, ajuda ae pfv

OBS: Uso sscanf2
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)