Raised This Month: $51 Target: $400
 12% 

Array Delete Item


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConorCC
Member
Join Date: Feb 2014
Old 08-14-2017 , 17:57   Array Delete Item
Reply With Quote #1

Dear Forum Users,

I have got a great problem with the Array function. Exactly, i have two different array list that I would like to check in them and remove some row. I would like to delete all rows from ArrayOne that NOT used in the ArrayTwo.

Here is the my Code:
PHP Code:
for ( new iArraySize(Winners); ++ )
        {
            for ( new 
jArraySize(g_VoteList); ++ )
            {
                if ( 
ArrayGetCell(Winnersi) == )
                    continue;
                
                
ArrayDeleteItem(g_VoteListj);
            }
        } 
Sorry for my English. But I hope you will understand me and my problem.
Thanks, J.

Last edited by ConorCC; 08-14-2017 at 17:57.
ConorCC is offline
Hedgehog Fog
Senior Member
Join Date: Jun 2010
Location: Ukraine
Old 08-15-2017 , 12:39   Re: Array Delete Item
Reply With Quote #2

Just use additional array:

PHP Code:
  new winnersNum ArraySize(Winners);
  new 
votesNum ArraySize(g_VoteList);
  new Array:
voteList ArrayCreate(1votesNum);

  for (new 
iwinnersNum; ++i) {
    new 
winner ArrayGetCell(Winnersi);

    for (new 
0votesNum; ++j) {
      if (
winner == ArrayGetCell(g_VoteListj)) {
        
ArrayPushCell(voteListwinner)
        break;
      }
    }
  }

  
ArrayDestroy(g_VoteList);
  
g_VoteList voteList
__________________

❄️ CS Snow Wars - Mod based on snowballs fights
🧟 CS Zombie Panic - A port of HL Zombie Panic!
🎃 CS Halloween Mod - Completely new gamemode for Halloween Holidays
📦 AMXXPack - CLI and build system for amxx projects
🔧 Custom Entities API - API to register custom entities

Last edited by Hedgehog Fog; 08-15-2017 at 12:44.
Hedgehog Fog 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 00:26.


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