AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Exclude Player Index (https://forums.alliedmods.net/showthread.php?t=227564)

K1d0x 10-03-2013 18:12

Exclude Player Index
 
Hello everybody, i have a question.... for example in public bomb_planted(index) i want to print two messages, one to planter and one message to other players excluding planter index...

Is right this method?

PHP Code:

public bomb_planted(id) {
    new 
pName[32];
    
get_user_name(idpNamecharsmax(pName));
    
    new 
Players[32];
    new 
playerCountiplayer;
    
get_players(PlayersplayerCount"b");
    for(
0playerCounti++)
        
player Players[i];
    
    if(
player == id) {
        
K1d0x_C_Color(id"#c[#gBonus Credits#c] #c%L"id"FOR_BOMB_PLANTED"iShowCredits);
    } else {
        
K1d0x_C_Color(player"#c[#gBonus Credits#c] #t%s #c%L"pNameplayer"BOMB_PLANTED"iShowCredits);
    }



Black Rose 10-03-2013 19:25

Re: Exclude Player Index
 
Yes. As long as you use some curly brackets for the loop.
Now you're just looping player = Players[i]; which will result in one message for the last player only.
So include the if statement inside of the loop.

fysiks 10-03-2013 20:52

Re: Exclude Player Index
 
Quote:

Originally Posted by K1d0x (Post 2044742)
Is right this method?

Please learn to test your code before posting a question about it.

K1d0x 10-05-2013 11:19

Re: Exclude Player Index
 
Quote:

Originally Posted by fysiks (Post 2044795)
Please learn to test your code before posting a question about it.

Haha, tested and works fine, i created this topic for asking if is good this method and to find if exists a better method... but thanks ;)


All times are GMT -4. The time now is 04:25.

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