Raised This Month: $ Target: $400
 0% 

Sort and check the maps


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-24-2008 , 12:54   Re: Sort and check the maps
Reply With Quote #11

My plugin is difficult ?!

- Save all maps in an array
- Pickup randomly x maps ( checking if it's not the current map/ map already pickup )
- Destroy the array.

That's all... Hu. It's more optimized and well-coded.
__________________
Arkshine is offline
DA
Veteran Member
Join Date: Nov 2005
Location: Germany/Münster
Old 04-24-2008 , 13:22   Re: Sort and check the maps
Reply With Quote #12

Quote:
Originally Posted by arkshine View Post
My plugin is difficult ?!

- Save all maps in an array
- Pickup randomly x maps ( checking if it's not the current map/ map already pickup )
- Destroy the array.

That's all... Hu. It's more optimized and well-coded.
Well, yours is difficult but if I can use mine, then I use mine because I know this is mine.
Yours is well-coded - yes but it's not more optimized. It do the same thing with different methods.

I hope you don't misunderstand me. I'm really happy and thankfully about your work. But I don't want that you give me the complete code so that I learn nothing.
__________________
DA is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-24-2008 , 13:34   Re: Sort and check the maps
Reply With Quote #13

Quote:
it's not more optimized. It do the same thing with different methods.
I can't agree.

It's better to use fopen, fgets, etc.. ( c++ like ) instead of read_file() in such situation. ( see the source of this native and you will understand ).
I'm using dynamic array to avoid to have a defined map limit ( so no need to edit the .sma ) and saving memory since the array is destroyed at the end.

It's just more efficient & optimized.
__________________

Last edited by Arkshine; 04-24-2008 at 13:46.
Arkshine is offline
DA
Veteran Member
Join Date: Nov 2005
Location: Germany/Münster
Old 04-24-2008 , 16:10   Re: Sort and check the maps
Reply With Quote #14

Quote:
Originally Posted by arkshine View Post
I can't agree.

It's better to use fopen, fgets, etc.. ( c++ like ) instead of read_file() in such situation. ( see the source of this native and you will understand ).
I'm using dynamic array to avoid to have a defined map limit ( so no need to edit the .sma ) and saving memory since the array is destroyed at the end.

It's just more efficient & optimized.
If you had read my function then you know that the most of that is included in it.

Well, I finally get every time the same warning. Now I think it is the best when I post the complete plugin. I hope someone can help me then better. Thanks
Attached Files
File Type: sma Get Plugin or Get Source (rockthevote_custom.sma - 360 views - 4.2 KB)
__________________
DA is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-24-2008 , 16:20   Re: Sort and check the maps
Reply With Quote #15

Quote:
If you had read my function then you know that the most of that is included in it.
Most ? ... Uhuh. What are you talking ?! You don't use dynamic array nor the new file native... Have you take a look into the source of read_file() at least ?!

I think you don't want to understand. You're wrong but whatever, I give up. It seems that I'm not enough good to explain well in english.

You say that you want to learn, but you ignore that I say, so, eh, good luck.
__________________

Last edited by Arkshine; 04-24-2008 at 16:27.
Arkshine is offline
DA
Veteran Member
Join Date: Nov 2005
Location: Germany/Münster
Old 04-25-2008 , 08:32   Re: Sort and check the maps
Reply With Quote #16

Quote:
Originally Posted by arkshine View Post
Most ? ... Uhuh. What are you talking ?! You don't use dynamic array nor the new file native... Have you take a look into the source of read_file() at least ?!

I think you don't want to understand. You're wrong but whatever, I give up. It seems that I'm not enough good to explain well in english.

You say that you want to learn, but you ignore that I say, so, eh, good luck.
Okay, sorry. I was a little bit tired yesterdy. It's my fault.
It's okay if you want no more help me.
__________________
DA is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-25-2008 , 11:44   Re: Sort and check the maps
Reply With Quote #17

Quote:
It's okay if you want no more help me.
I can't help you, because I don't see the purpose to help you with such of bad code. I mean, what you have done is, for me, a bad way. That's why I give you a full example using the dynamic array and the new file native, which are better for such case.

Also, there is another way. Instead of saving all maps, you can search the character '^n' which means 'new line'. It stays at the end of each line. eg : for the fourth map, you have to search le fourth '^n' in the file ( fseek() ). After that, using fread_blocks() or fgets() to retrieve the string before this character.
But as the first method, you have to read all the datas into the file.

That's why, what I've done is fine, easier and more safer.
__________________

Last edited by Arkshine; 04-25-2008 at 11:54.
Arkshine 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 07:44.


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