Raised This Month: $165 Target: $400
 41% 

Sorting System


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnimalMonster
Senior Member
Join Date: May 2020
Old 01-11-2021 , 05:05   Sorting System
Reply With Quote #1

Hey, i wanted to make a little sorting system by rairity and the weaponid on a weapon menu but i realised that i don t know how i should do it...
Anyone knows to show and example of a sort system other than the amxx's one?
Rarities are from 0 to 5 and weapon ids are stored into an array with size of 24.
__________________
A little of scripting makes a MIRACLE.
=============================================
DeclineD#7346 // for everyone who wants a friend..
AnimalMonster is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 01-11-2021 , 05:33   Re: Sorting System
Reply With Quote #2

This is the work i ve done so far
PHP Code:
stock PlsSort(const lala[])
{
for(new 
0g_WeaponCounti++)
{
new 
idk g_WeaponCount
new WeaponBasedOn ArrayGetCell(BasenOni)
new 
WeaponRarity ArrayGetCell(Item_Rarity)
new 
sr[idk], sb[idk]

for(new 
l=0;l<24;l++)
{
if(
WeaponBasedOn == weapon_based[l])
{
for(new 
k=0k<5;k++)
{
if(
WeaponRarity == k)
{
sr[i] = k
break;
}
sb[i] = l
}
for(new 
p=0p<g_WeaponCount;p++)
{
if(
sr[i] < sr[p] && sb[i] > sb[p])
{
lala[p] = i
}
}
}
return 
1

Would it work??
__________________
A little of scripting makes a MIRACLE.
=============================================
DeclineD#7346 // for everyone who wants a friend..

Last edited by AnimalMonster; 01-11-2021 at 05:33.
AnimalMonster is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-11-2021 , 09:15   Re: Sorting System
Reply With Quote #3

Please, no. Simply use ArraySort() or ArraySortEx() if running AMXX dev-builds.
If you need help, show how the arrays are defined because that code is a complete mess and make no sense.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
AnimalMonster
Senior Member
Join Date: May 2020
Old 01-15-2021 , 04:48   Re: Sorting System
Reply With Quote #4

After a few tries i ve got to nothing and 2nd array can be this: new x[] or new x: x = ArrayCreate(num, num2).
I need to sort some items based on their rarity(5) and return it.
__________________
A little of scripting makes a MIRACLE.
=============================================
DeclineD#7346 // for everyone who wants a friend..
AnimalMonster is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-15-2021 , 08:29   Re: Sorting System
Reply With Quote #5

Show the full array definitions.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 22:40.


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