SA-MP Forums Archive
[AJUDA] IF - 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] IF (/showthread.php?tid=664885)



[AJUDA] IF - hurubuh - 14.03.2019

Como faзo pra colocar isso:

PHP Code:
if(<= Profissao[playerid] <= 8
Assim:

PHP Code:
if(Profissao[playerid] == 123
Quando eu coloco assim:

PHP Code:
if(Profissao[playerid] == 123
Da este erro:

PHP Code:
warning206redundant testconstant expression is non-zero 



Re: [AJUDA] IF - Don_Speed - 14.03.2019

PHP Code:
if(Profissao[playerid] <= 3
<= igual ou menor

PHP Code:
if(Profissao[playerid] < 3menor que 3
if(>(Profissao[playerid]) < 3menor que 3 e maior que 0 



Re: [AJUDA] IF - ipsLuan - 14.03.2019

Vocк tem que usar ||.

if(a == 1 || a == 2 || a == 3)

Larga de ser preguiзoso e vб estudar sobre a linguagem.

Lembrando que vocк pode usar as operaзхes matemбticas.

== = igual
>= = maior ou igual
<= = menor ou igual

E tambйm as interpretaзхes do compilador

&& = e
|| = ou


Re: [AJUDA] IF - hurubuh - 14.03.2019

Mas quero tipo, que eu possa colocar quantos numeros eu quiser dentro disso:

PHP Code:
if(Profissao[playerid] <= 3



Re: [AJUDA] IF - ipsLuan - 14.03.2019

Entгo, cara...
Jб disse:

Ou vocк faz assim...
PHP Code:
if(Profissao[playerid] >= && Profissao[playerid] <= 3)
    
//Se profissгo for maior ou igual a 1 e menor ou igual a 3. (1, 2, 3) 
Ou faz assim...
PHP Code:
switch(Profissao[playerid])
{
    case 
1: { /* profissao == 1 */ }
    case 
2: { /* profissao == 2 */ }
    case 
3: { /* profissao == 3 */ }
    case 
4..6 /* profissao == 4, 5 e 6 */ }
    case 
7..50 /* profissao = 7, 8, 9, 10... ...48, 49, 50 */ }




Re: [AJUDA] IF - hurubuh - 14.03.2019

Quote:
Originally Posted by ipsLuan
View Post
Entгo, cara...
Jб disse:

Ou vocк faz assim...
PHP Code:
if(Profissao[playerid] >= && Profissao[playerid] <= 3)
    
//Se profissгo for maior ou igual a 1 e menor ou igual a 3. (1, 2, 3) 
Ou faz assim...
PHP Code:
switch(Profissao[playerid])
{
    case 
1: { /* profissao == 1 */ }
    case 
2: { /* profissao == 2 */ }
    case 
3: { /* profissao == 3 */ }
    case 
4..6 /* profissao == 4, 5 e 6 */ }
    case 
7..50 /* profissao = 7, 8, 9, 10... ...48, 49, 50 */ }

Mano vocк nгo ta entendo, eu quero que tipo, nгo quero que fique entre exemplo:

PHP Code:
if(<= Profissao[playerid] <= 8
Quero que eu possa colocar os numeros que eu quero que fique definido exemplo:

PHP Code:
if(Profissao[playerid] == 1810



Re: [AJUDA] IF - ipsLuan - 14.03.2019

Quem nгo estб entendendo й vocк!

PHP Code:
if(Profissao[playerid] == || Profissao[playerid] == || Profissao[playerid] == 10



Re: [AJUDA] IF - Don_Speed - 14.03.2019

Vocк quer fora da sequencia mas nгo se da ao luxo de tentar aprender.
De procurar metodos , quero pronto , o que o luan disse e demonstrou e a melhor forma.

PHP Code:
switch(Profissao[playerid]) 

    case 
1,9: { /* profissao == 1 */ 


Agora pelo menos procure ...
Tenta fazer e a melhor forma de se aprender .