Raised This Month: $ Target: $400
 0% 

[HELP] If statements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-03-2016 , 12:34   [HELP] If statements
Reply With Quote #1

Okay, so, im getting a little confused lately with a particular case of if statements, more exactly the following, i know what "!" means, but i cant process it in this sittuation..
can anyone explain it to me please?

PHP Code:

if(!user_is_arab(id) || !user_is_belgian(id))
{
        do 
this
}

if(!
user_is_arab && !user_is_belgian(id))
{
        do 
this

__________________
Depresie is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-03-2016 , 12:36   Re: [HELP] If statements
Reply With Quote #2

PHP Code:
if(!user_is_arab(id) Or !user_is_belgian(id)) 
PHP Code:
if(!user_is_arab(id) And !user_is_belgian(id)) 
|| = Or

&& = And


Hope this helps
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-03-2016 , 12:41   Re: [HELP] If statements
Reply With Quote #3

i know that.. here is what i need...

how do i write these two examples into one?

PHP Code:
if(!is_user_arab(id))
{
         
1
}

if(!
is_user_belgian(id))
{
          
1

__________________

Last edited by Depresie; 01-03-2016 at 12:41.
Depresie is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-03-2016 , 12:51   Re: [HELP] If statements
Reply With Quote #4

PHP Code:
if(!user_is_arab(id) || !user_is_belgian(id))
{
        

Use this one if only 1 of them needs to be true
PHP Code:
if(!user_is_arab && !user_is_belgian(id))
{
        

Use this one if both of them needs to be true

Depending on what you want to do both of them is correct.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 01-03-2016 at 12:54.
wickedd is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-03-2016 , 13:23   Re: [HELP] If statements
Reply With Quote #5

as in the first case, if any of that is true, i dont want it executed further
i just digged in my pc and found an older test server and managed a quick test with client prints, and it resulted that your second code is what i wanted

sorry for the idiot question, im scripting without testing, i have pc problems...
__________________
Depresie is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 01-03-2016 , 13:39   Re: [HELP] If statements
Reply With Quote #6

How how can be arab and belgian at the same time?? Oh.. Anyway, use this:

if(user_is_arab(id) || user_is_belgian(id) && (!user_is_arab(id) || !user_is_belgian(id)))

This means that action will be executed only if he's not both belgian and arab.

This means that
siriusmd99 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-03-2016 , 14:38   Re: [HELP] If statements
Reply With Quote #7

Testing your own code is a critical part of learning. I highly recommend that you always test your code before asking a question on the forums.
__________________

Last edited by fysiks; 01-03-2016 at 14:47.
fysiks is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-03-2016 , 15:49   Re: [HELP] If statements
Reply With Quote #8

@sirius, well, you can have double nationality, also it was just an example
im sorry, i didnt explain well, i wanted the following written differently with !

PHP Code:
public function(id)
{
if(
is_user_belgian(id) || is_user_arab(id))
{
         return;
}
do 
this

@fysiks, i usualy do, but now i cant, my windows is realy messed up... anti virus went crazy.. sorry
__________________
Depresie is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-03-2016 , 18:14   Re: [HELP] If statements
Reply With Quote #9

Quote:
Originally Posted by Depresie View Post
my windows is realy messed up... anti virus went crazy.. sorry
Just do not use anti virus, except the computer's user, which is best anti virus ever.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-03-2016 at 19:46. Reason: spelling fix
addons_zz is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 01-03-2016 , 21:07   Re: [HELP] If statements
Reply With Quote #10

too late bro... xD
__________________
Depresie is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode