Raised This Month: $ Target: $400
 0% 

[CSS/CSGO] Need help with array sort


Post New Thread Reply   
 
Thread Tools Display Modes
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-29-2015 , 14:24   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #11

this code work but not correctly, it print messages, but without names and with incorrect order, for example like on last try, 0, 6, 3.

Spoiler

Last edited by BAILANDO; 10-29-2015 at 14:25. Reason: Missing tag
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-29-2015 , 14:43   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #12

or how to use SortCustom1D to sort two array in parallel, when sort integers then sort strings same as integers. its possible to use with this functions?
BAILANDO is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-29-2015 , 14:52   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #13

PHP Code:
public void OnPluginStart()
{
    
int g_Kills[MAXPLAYERS 1];
    for (
int i 1<= MAXPLAYERSi++)
    {
        
g_Kills[i] = GetRandomInt(030);
    }
    
    for (
int i 1<= MAXPLAYERSi++)
    {
        
g_Kills[i] = g_Kills[i] << 16 i;
    }
    
    
SortIntegers(g_Killssizeof(g_Kills), Sort_Descending);
    
    for (
int i 1<= MAXPLAYERSi++)
    {
        
PrintToServer("Place: %d, client: %d, kills: %d"ig_Kills[i] & 0xFFFFg_Kills[i] >> 16);
    }

:F

Last edited by Miu; 10-29-2015 at 14:56.
Miu is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-29-2015 , 15:09   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #14

Also I think you would want

PHP Code:
new float:g_kdr[MAXPLAYERS 1]; 
to be

PHP Code:
new Float:g_kdr[MAXPLAYERS 1]; 
Miu is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-29-2015 , 15:10   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #15

whoa, i need only explain what is "& 0xFFFF" and << 16 or >> 16 (forgot, really i dont use this in C++ :X)
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-29-2015 , 15:40   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #16

i try it, works correctly but one thing, i kill 8 people in 60 seconds(BOTS), but my name is not listed here, only bots, everytime. THanks

Example:
Place: 1, client: Seth, kills: 3
Place: 2, client: Xander, kills: 1
BAILANDO is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-29-2015 , 15:43   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #17

and my old function when i use it before yours:
Code:
while (prehodene) {         prehodene = false;         for (new i = 0; i < MaxClients; i++) {             if (g_Kills[i] > g_Kills[i + 1])             {                 pom = g_Kills[i];                 pom1 = g_ids[i];                 //Format(pomName, 255, g_Names[i]);                 g_Kills[i] = g_Kills[i + 1];                 g_ids[i] = g_ids[i + 1];                 //Format(g_Names[i], PLATFORM_MAX_PATH, g_Names[i + 1]);                 g_Kills[i + 1] = pom;                 g_ids[i + 1] = pom1;                 //Format(g_Names[i + 1], PLATFORM_MAX_PATH, pomName);                 prehodene = true;             }         }     }

have problem, my array is not sorted, this function do nothing, no values has been swtiched

Last edited by BAILANDO; 10-29-2015 at 15:45.
BAILANDO is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-29-2015 , 16:20   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #18

Quote:
Originally Posted by BAILANDO View Post
i try it, works correctly but one thing, i kill 8 people in 60 seconds(BOTS), but my name is not listed here, only bots, everytime. THanks

Example:
Place: 1, client: Seth, kills: 3
Place: 2, client: Xander, kills: 1
Ah! Would help to look at the code
Miu is offline
BAILANDO
Senior Member
Join Date: Feb 2015
Location: Slovakia
Old 10-30-2015 , 03:03   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #19

Here is code, thanks

Spoiler
BAILANDO is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 10-30-2015 , 06:46   Re: [CSS/CSGO] Need help with array sort
Reply With Quote #20

oh yeah my bad, change

PHP Code:
    for (new 1<= 3i++)
    {
        
PrintToChatAll("Place: \x03%d\x01, client: \x04%N\x03, kills: %d"ig_Kills[i] & 0xFFFFg_Kills[i] >> 16);
    } 
to

PHP Code:
    for (new 03i++)
    {
        
PrintToChatAll("Place: \x03%d\x01, client: \x04%N\x03, kills: %d"1g_Kills[i] & 0xFFFFg_Kills[i] >> 16);
    } 
Miu 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 06:00.


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