AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get id's id (https://forums.alliedmods.net/showthread.php?t=339867)

SoccerjamTR 10-05-2022 08:31

get id's id
 
I have
PHP Code:

#define RECORDS 2
enum {
    
KILL
    SELFKILL
}
new 
TopPlayer[3][RECORDS+1]

TopPlayer[1][KILL] , TopPlayer[1][SELFKILL

and I want to ( TopPlayer[1][KILL] ) [SELFKILL] how to i learn top kill player's selfkill number?
I try TopPlayer[1][KILL][SELFKILL] but it gives error.

fysiks 10-05-2022 22:16

Re: get id's id
 
You need to use a named enum:

PHP Code:

enum myEnum {
    
KILL,
    
SELFKILL
}

new 
TopPlayer[32][myEnum


SoccerjamTR 10-06-2022 04:38

Re: get id's id
 
I tried but it gave error.
Top Players KILL and SELFKILL
Topplayer[1][KILL] = 10(player A) Topplayer[1][SELFKILL] = 7(player B)

Player A's statistics:
Record[id][KILL] = 10 Record[id][SELFKILL] = 5
Player B's statistics:
Record[id][KILL] = 9 Record[id][SELFKILL] = 7

Now, Topplayer[KILL] id = Player A but he isn't top selfkill because it's number 5 and player B's 7.
I need to learn top player A's selfkill number.
I use it like this message: Top KILLER'S(Rank 1-Player A 10 and Self-Kills: 5 Rank 2-Player B 9 and Self Kills 7)

zXCaptainXz 10-06-2022 05:58

Re: get id's id
 
Record[TopPlayer[1][KILL]][SELFKILL] should return the most killing player's self kills then

SoccerjamTR 10-26-2022 16:56

Re: get id's id
 
it doesn't work.

Natsheh 10-26-2022 17:59

Re: get id's id
 
PHP Code:

....

new 
szName[32], aTopFraggers[MAX_PLAYERS], iCount GetPlayersList(3aTopFraggersPlayers"funcComparsion");

server_print("TOP #%d FRAGGERS :-"iCount);

for(new 
iiCounti++)
{
    
get_user_name(aTopFraggers[i], szNamecharsmax(szName));
    
server_print("* %s"szName);
}

....

public 
funcComparsion(idcompared)
{
    if(
get_user_frags(id) < get_user_frags(compared))
    {
        return 
1;
    }
    return 
0;
}

GetPlayersList(TopFraggersCount=3ArrayList[MAX_PLAYERS], const funcComparePlayersStats[])
{
    static 
players[MAX_PLAYERS], pnum;
    
get_players(playerspnum"h");

    if(!
pnum) return 0;

    if(
TopFraggersCount pnumTopFraggersCount pnum;

    new 
iListCount;

    for(new 
jiplayerchoseniPointeriFuncID get_func_id(funcComparePlayersStats); TopFraggersCountj++)
    {
        
chosen players[ (iPointer=0) ];

        for(
1pnumi++)
        {
            
player players];

            if(
callfunc_begin_i(iFuncID) == 1)
            {
                
callfunc_push_int(chosen);
                
callfunc_push_int(player);
                if(
callfunc_end() == 1)
                {
                    
chosen player;
                    
iPointer i;
                }
            }
        }

        
playersiPointer ] = players[ --pnum ];
        
ArrayListiListCount++ ] = chosen;
    }

    return 
iListCount;



SoccerjamTR 10-27-2022 05:08

Re: get id's id
 
PHP Code:

#define RECORDS 2
enum {
    
KILL
    SELFKILL
}
new 
TopPlayer[3][RECORDS+1]
new 
TopPlayerName[RECORDS+1][33]
new 
Record[33][RECORDS+1]
TopPlayer[1][KILL] , TopPlayer[1][SELFKILL]

Event_Record(idrecordtypeamtexp) {
    if(
amt == -1)
        
Record[id][recordtype]++
    else
        
Record[id][recordtype] = amt

    
new playerRecord Record[id][recordtype]
    if(
playerRecord TopPlayer[1][recordtype])
    {
        
TopPlayer[0][recordtype] = id
        TopPlayer
[1][recordtype] = playerRecord
        
new name[MAX_NAME_LENGTH+1]
        
get_user_name(id,name,MAX_NAME_LENGTH)
        
format(TopPlayerName[recordtype],MAX_NAME_LENGTH,"%s",name)
    }




I didn't understand your code. My functions are example. I need index Topplayer[1][KILL] and this index's SELFKILL number because i want to make this:
newid = Topplayer[1][KILL](How to learn this player id)
Record[newid][SELFKILL]
I tried newid = find_player("a",TopPlayerName[KILL]) but sometimes it return 0

I use it like this message: Top KILLER'S(Rank 1-Player A 10 and Self-Kills: 5 )
PHP Code:

client_print(0,print_chat,"Rank1 Player %s - %d and Selfkills %d"id,Record[newid][KILL],Record[newid][SELFKILL]) 


SoccerjamTR 12-07-2022 07:19

Re: get id's id
 
Can you help me? :)


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

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