Raised This Month: $ Target: $400
 0% 

some noob-questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
simple_user
Member
Join Date: Apr 2012
Location: Latvia, the cube
Old 05-03-2012 , 16:43   some noob-questions
Reply With Quote #1

1) what does this mean? :
if (!killer || !victim) // ! in front of id ?

for example, I know that:
if ( killer != gSuperPlayerCT || killer != gSuperPlayerT ) // means if a is not equal to b or a isn't equal to c

2) and what is the differences between these:

public (weaponId)

if(weaponId == CSW_KNIFE)
{
do...
}


and this:

new weapon = get_user_weapon(id);

if(weapon == CSW_KNIFE)

{
do...

}
simple_user is offline
Send a message via Skype™ to simple_user
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-03-2012 , 17:04   Re: some noob-questions
Reply With Quote #2

PHP Code:
if (!killer || !victim// ! in front of id ? 

PHP Code:
if (killer == || victim == 0
---

means if a is not equal to b or a isn't equal to c

if i understand you... yes..

-------------

public PUBLIC_NAME(weaponId)

if(weaponId == CSW_KNIFE)
{
do...
}

this is a public function with the param weapoinId

and the second you obten the weaponid;

example

PHP Code:
new weapon get_user_weapon(id); 

if(
weapon == CSW_KNIFE

do... 
}

// or i can do this...

new weapon get_user_weapon(id); 

my_function(weapon)

}

public 
my_function(WeaponId)
{
 
if(
WeaponId == CSW_KNIFE

do... 
}


__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 05-04-2012 at 10:23.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-03-2012 , 17:09   Re: some noob-questions
Reply With Quote #3

Quote:
Originally Posted by rak View Post
PHP Code:
if (!killer || !victim// ! in front of id ? 

PHP Code:
if (killer <= || victim <= 0
That's wrong. ! means not. In this case, it means if not value, meaning if there is no value.
For there to be no value, it would have to have 0.

Here's an example:
Code:
new var1 = 200; new var2 = -10; new var3 = 0; if(var1) // true if(var2) // true if(var3) // false // !var1 = not 200 = 0 // !var2 = not -10 = 0 // !var3 = not 0 = 1 if(!var1) // false if(!var2) // false if(!var3) // true
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-03-2012 , 17:26   Re: some noob-questions
Reply With Quote #4

Quote:
Originally Posted by Exolent[jNr] View Post
That's wrong. ! means not. In this case, it means if not value, meaning if there is no value.
For there to be no value, it would have to have 0.
yes, my mistake; sorry xD i don't sleep u.u; i don't know what I think xD
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Old 05-03-2012, 17:26
simple_user
This message has been deleted by simple_user.
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-03-2012 , 17:29   Re: some noob-questions
Reply With Quote #6

Quote:
Originally Posted by simple_user View Post
So basically:

if(!killer || !victim) // means if there is a killer or victim
return;
{
client_print(victim, print_chat, "A person killed you, not the sunstroke
.")
}


?
nope;

and use [php][/php] for code

is
PHP Code:
{
if(!
killer || !victim)// means if there is a killer or victim
            
return;
client_print(victimprint_chat"A person killed you, not the sunstroke.")

__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 05-03-2012 at 17:29.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-04-2012 , 03:39   Re: some noob-questions
Reply With Quote #7

Quote:
Originally Posted by simple_user View Post
So basically:

PHP Code:
if(!killer || !victim//  if no killer or victim, return value 0. if there is a killer or victim then do something
return;
    {
       
client_print(victimprint_chat"A person killed you, not the sunstroke[/I][I].")
    } 
?
That code doesn't make sense anyways.

The if condition will be true if either there is no killer or there is no victim (which doesn't make sense).
__________________
fysiks is offline
simple_user
Member
Join Date: Apr 2012
Location: Latvia, the cube
Old 05-03-2012 , 18:09   Re: some noob-questions
Reply With Quote #8

PHP Code:
you knowI don't believe you, because you said something about your sleep ^ ^ 
simple_user is offline
Send a message via Skype™ to simple_user
simple_user
Member
Join Date: Apr 2012
Location: Latvia, the cube
Old 05-04-2012 , 08:29   Re: some noob-questions
Reply With Quote #9

I found it in ut_killstreak_adv plugin. This looked unusual to me, so I was wondering.
Here's the context:

PHP Code:
public client_death(killer,victim,weapon,hitplace,TK)
{
    if(!
killer || !victim)
        return;
    
    static 
kname[32], vname[32];
    
get_user_name(killer,kname,31);
    
get_user_name(victim,vname,31);
    
    if(
hitplace == HIT_HEAD && get_pcvar_num(hsenable) == )
    {
        
set_hudmessage(00255, -1.00.3006.06.0);
        
show_hudmessage(0hsmessages[random(sizeof hsmessages)], knamevname);
        
client_cmd(0,"spk %s",hslist[random(sizeof hslist)]);
    }
    
    if(
weapon == CSW_KNIFE && get_pcvar_num(knifeenable) == )
    {
        
set_hudmessage(2550255, -1.00.3006.06.0);
        
show_hudmessage(0knmessages[random(sizeof knmessages)], knamevname);
        
client_cmd(0,"spk %s",knlist[random(sizeof knlist)]);   
    } 

Last edited by simple_user; 05-04-2012 at 08:31.
simple_user is offline
Send a message via Skype™ to simple_user
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-04-2012 , 08:54   Re: some noob-questions
Reply With Quote #10

Operator ! means is not
Operator != means is not equal with
Operator == means is equal with

PHP Code:
static i;
0;

if( !
) { /* do this */ // i is 0

static c];
c] = '';

if( !
c] ) { /* do this */ // c[ 0 ] is ''

"";

if( !
c] ) { /* do this */ // c[ 0 ] is '' 

Quote:
Originally Posted by rak View Post
PHP Code:
if (!killer || !victim// ! in front of id ? 

PHP Code:
if (killer <= || victim <= 0
Please edit.
__________________

Last edited by claudiuhks; 05-04-2012 at 09:11.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Reply


Thread Tools
Display Modes

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 00:25.


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