SA-MP Forums Archive
[Ajuda] IsNull - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] IsNull (/showthread.php?tid=526374)



IsNull - Ts3 - 17.07.2014

pawn Код:
if( isnull( params ) ) return SendClientMessage(playerid, -1, "Erro: /all [texto]");
Estava vendo alguns tуpicos e vi pessoas usando isnull ele verifica se o parвmetro que vocк digitou estб vazio sendo assim logo retorna uma mensagem ex:[Uso correto: /all [txt]], entгo gostaria saber se para usar isnull acima necessita de alguma include ou nгo.


Re: IsNull - WLSF - 17.07.2014

se vocк usa zcmd nгo precisa, provavelmente jб vem, mas й um mйtodo bбsico besta.

pawn Код:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
- retirado da include ZCMD.


Re: IsNull - zSuYaNw - 17.07.2014

ou pode ser simplesmente com EOS*

pawn Код:
if(minh_string[0] == '\0'){

}

Verificar se string й nula.


*Estudando*
pawn Код:
main(){
    new
        string[5]
    ;
   
    if(string[0] == '\0'){
        printf(#String estб vazia);
    }
   
   
    string[0] = 'h';
    string[1] = 'e';
    string[2] = 'l';
    string[3] = 'l';
    string[4] = 'o';
   
    if(string[0] != '\0'){
        printf(#String nгo estб vazia);
        printf("String: %s", string);
    }

}



Re: IsNull - Ts3 - 17.07.2014

Ah valeu William, sim eu uso ZCMD entгo acho que posso usar sem problemas.