Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Better way of doing this ?

 
  • 0 Vote(s) - 0 Average
Pawn Better way of doing this ?
mouiz
Offline

Burgershot Member
Posts: 27
Threads: 11
Joined: May 2019
Reputation: 0
#1
2019-07-07, 06:38 PM (This post was last modified: 2019-07-07, 06:39 PM by mouiz.)
Is there a better way of getting the size of an enum ?


Code:
enum modes
{
    MODE_fgrs,
    MODE_gdsrg,
    MODE_lol,
    MODE_third
};


new Modes [modes];

new size = sizeof (Modes);
Freaksken
Offline

open.mp Developer

Posts: 80
Threads: 4
Joined: Feb 2019
Reputation: 6
Location: Belgium
#2
2019-07-07, 07:04 PM
You can just use the name of the enum. This prints the same values:
PHP Code:
printf("NumElements %d, sizeof %d.", modes, sizeof(Modes)); 
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode