Jump to content

Question

Posted

am si eu o intrebare interesanta pentru mine

care e diferenta intre

if(!strcmp(cmd, "comanda", true))
si
if(strcmp(cmd, "comanda") == true)

Cat se poate de explicit daca se poate ms mult...

Samp.OnlyPro.ro - RolePlay - Join Us !

2 answers to this question

Recommended Posts

Posted

! schimba valoarea de adevar a unei expresii. Ex.: ( 4 > 2 ) este adevarata, iar !( 4 > 2 ) este falsa.

Singura valoare pe care strcmp o returneaza este 0, daca stringurile comparate sunt la fel.

Daca ai ! in fata, operatorul ignora comparatia si vei putea sa executi comanda chiar daca tastezi "/comanda2342324234sdfsd".

In al doilea exemplu, nu-ti va merge comanda pentru ca ai strcmp( cmd, "comanda" ) == true. strcmp nu returneaza valoarea 1, si va aparea Unknown command. if ( strcmp( cmd, "comanda", true ) == 0 ) { SetPlayerHealth( playerid, 0.0 ); } - Daca strcmp returneaza 0 omor jucatorul.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.