Raised This Month: $535 Target: $400
 133% 

null


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
000
Member
Join Date: Jul 2022
Old 08-04-2022 , 07:43   null
Reply With Quote #1

null

Last edited by 000; 10-18-2022 at 07:28.
000 is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 08-04-2022 , 11:06   Re: How to format 2D Array?
Reply With Quote #2

If you find a solution for your problem you should post it instead of blanking your thread.
That way others doing the same mistake find it and can learn from it.
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de

Last edited by Sillium; 08-04-2022 at 11:07.
Sillium is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 08-15-2022 , 08:36   Re: How to format 2D Array?
Reply With Quote #3

For the ones that are still trying to find a solution, sizeof(MyArray) will retrieve the maximum values that can be stored in the array and sizeof(MyArray[]) will give the maximum length of the value in the array.
__________________
SpirT is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-15-2022 , 12:24   Re: How to format 2D Array?
Reply With Quote #4

But you can't compile the plugin if you use variables with a name starting with a number.

This code will compiled:
PHP Code:
public void OnPluginStart()
{
    
char Array[3][6], Array2[3][6], sValue[24] = ""Formatted[24];

    
ExplodeString(sValue",", Array, sizeof(Array), sizeof(Array[]));
    
ExplodeString(sValue","Array2sizeof(Array2), sizeof(Array2[]));

    
FormatEx(Formattedsizeof(Formatted), "%s %s", Array[0], Array2[2]);

__________________
Grey83 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 08-21-2022 , 17:23   Re: How to format 2D Array?
Reply With Quote #5

Quote:
Originally Posted by 000 View Post
Also: I didn't use sizeof() to spare some time. And I think without it it is faster as well...
No, not faster: with sizeof() size is determined at compile time and never calculated again.
__________________
Grey83 is offline
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 03:50.


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