AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved range shortcut question (https://forums.alliedmods.net/showthread.php?t=326776)

tepegoz 08-16-2020 11:26

range shortcut question
 
I have these codes:
PHP Code:

if(playerid == || playerid == || playerid == || playerid == || playerid == 5){
....


I want to shortcut theese codes. How to I do like this : if(playerid == (1,2,3,4,5)){ ?

Bugsy 08-16-2020 12:42

Re: range shortcut question
 
PHP Code:

if ( <= playerid <= )
{



if you wanted to maybe exclude 3. Read up on switch statements to see what else you can do.
PHP Code:

switch ( playerid )
{
    case 
1,2:
    {
    
    }
    case 
4,5:
    {
    
    }
    default:
    {
        
//anything other than 1,2,4,5
    
}



tepegoz 08-16-2020 12:59

Re: range shortcut question
 
thanks


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

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