Raised This Month: $ Target: $400
 0% 

[SOLVED]Variable for every player [Help]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-02-2010 , 21:34   Re: Variable for every player [Help]
Reply With Quote #1

Quote:
Originally Posted by Callesson View Post
Can you also explain why i'm gonna use "[33]" ?
What does that mean?
Arrays are indexed starting at zero so when you dimension it with 33 the first index is 0, the second is 1, and so on, leaving the last one at 32. Player ids range from 1 to 32. If you only used 32 for the dimension then there would be no 32 index, the last index would be 31 (aka warning[32] would not exist).
__________________
fysiks is offline
Callesson
Member
Join Date: Jan 2010
Old 12-03-2010 , 14:38   Re: Variable for every player [Help]
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
Arrays are indexed starting at zero so when you dimension it with 33 the first index is 0, the second is 1, and so on, leaving the last one at 32. Player ids range from 1 to 32. If you only used 32 for the dimension then there would be no 32 index, the last index would be 31 (aka warning[32] would not exist).
Auw Cool ^^ Thanks
Quote:
Originally Posted by drekes View Post
cool, thanks for the info.
You learn something new every day

And TY Bugsy
__________________
Callesson is offline
Callesson
Member
Join Date: Jan 2010
Old 12-03-2010 , 15:03   Re: [SOLVED]Variable for every player [Help]
Reply With Quote #3

Sorry for double post!
But I changed the code to this. Now it fits my goal better
Does it look alright ?
Code:
public kick( id )
{
    if( warning[ id ] == 2 )
    {
        client_print( id , print_chat , "[Watch your lang] Next time ban!" );
        warning[ id ] = 3;
    }
    else if( warning[ id ] == 3 )
    {
        client_print( id , print_chat , "[Watch your lang] BANNED!" );
        warning[ id ] = 0;
    }
    else if ( ++warning[ id ] !=2 || warning[ id ] != 3)
    {
        client_print( id , print_chat , "[Watch your lang] %i/3" , warning[ id ] );
    }

    return PLUGIN_HANDLED;
}
__________________
Callesson is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-03-2010 , 16:32   Re: [SOLVED]Variable for every player [Help]
Reply With Quote #4

Would be better to use a switch.

Code:
public kick( id ) {     switch( warning[ id ] )     {         case 2:         {             client_print( id , print_chat , "[Watch your lang] Next time ban!" );             warning[ id ]++;         }         case 3:         {             client_print( id , print_chat , "[Watch your lang] BANNED!" );             warning[ id ] = 0;         }         default:         {             client_print( id , print_chat , "[Watch your lang] %i/3" , warning[ id ] );             warning[ id ]++;         }     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 11:23.


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