AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   one Item max per team (https://forums.alliedmods.net/showthread.php?t=189992)

CS-A-Roland 07-13-2012 13:11

one Item max per team
 
Hey guy's im new in scripting with amxmodx plugins. My Question is easy, i want to restrict an item to the best player in a tream, but it dint work.
There are at the player start not realy a "best" player so i think thers the bug and so can more than one player run with this item.

How i can restrict it to "one" item only per team and then also for the last player wich is alife?!

Work it with:
Code:

if( g_iCurrentRound == 0 )
return ITEM_DISABLED;

if i turn it to:
Code:

if( g_iCurrentRound == 1 )
return ITEM_DISABLED;

Or means iCurrentRound the first round in the game?!
By the way thanks for help!

Aooka 07-13-2012 14:03

Re: one Item max per team
 
Can you show your code ? please

CS-A-Roland 07-13-2012 14:34

Re: one Item max per team
 
this is it i think...

Code:

public LaserItem_Callback( id, hMenu, iItem )
    {
        if( g_iCurrentRound == 0 )
            return ITEM_DISABLED;
           
        new iFrags = get_user_frags( id );
        new iDeaths = get_user_deaths( id );

        new iPlayerFrags;
       
        new iPlayers[ 32 ], iNum;
        get_players( iPlayers, iNum, "ae", "CT" );
       
        if( iNum == 1 )
            return ITEM_DISABLED;
           
        for( new i = 0, iPlayer; i < iNum; i++ )
        {
            iPlayer = iPlayers[ i ];
           
            if( !is_user_alive( iPlayer ) || iPlayer == id )
                continue;
               
            iPlayerFrags = get_user_frags( iPlayer );
           
            if( iPlayerFrags > iFrags )
                return ITEM_DISABLED;
               
            else if( iPlayerFrags == iFrags )
            {
                if( get_user_deaths( iPlayer ) < iDeaths )
                    return ITEM_DISABLED;
            }
        }
       
        return ITEM_ENABLED;
       
    }

And at the moment it works to the beginning for all, if they change to another item it dosent work... but if they get a weapon of an player wich have the laser it works again...
It just sould be for the best and later in the round for the last player...


All times are GMT -4. The time now is 15:06.

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