SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/01/2020, 08:42 PM   #1
Edvukas
Little Clucker
 
Join Date: Nov 2018
Posts: 27
Reputation: 0
Default new or enum?

Hi, what should I choose for storing variables? Like admin, vip, cuffed, has something etc... So Enum or new?
Edvukas is offline   Reply With Quote
Old 19/01/2020, 09:36 PM   #2
homelessdrop
Big Clucker
 
homelessdrop's Avatar
 
Join Date: Jan 2016
Posts: 80
Reputation: 17
Default Re: new or enum?

Enum's
__________________

Veteran designer, mapper and model maker.
Since of 2011

Discord: homelessdrop#2166
homelessdrop is online now   Reply With Quote
Old 20/01/2020, 08:55 PM   #3
Edvukas
Little Clucker
 
Join Date: Nov 2018
Posts: 27
Reputation: 0
Default Re: new or enum?

Why enums?
Edvukas is offline   Reply With Quote
Old 20/01/2020, 09:14 PM   #4
DomagojSellug
Huge Clucker
 
DomagojSellug's Avatar
 
Join Date: Sep 2016
Location: Croatia
Posts: 255
Reputation: 22
Default Re: new or enum?

pawn Code:
enum PlayerData
{
    Password,
    Admin,
    Money,
    Score
}
new Player[MAX_PLAYERS][PlayerData];
__________________

San Andreas Multiplayer server based off Counter Strike: Global Offensive.

Join us today!

DISCORD: discord.sa-go.info
WEBSITE: http://sa-go.info
SERVER IP: samp.sa-go.info
DomagojSellug is offline   Reply With Quote
Old 20/01/2020, 09:44 PM   #5
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,193
Reputation: 420
Default Re: new or enum?

Quote:
Originally Posted by Edvukas View Post
Why enums?
Makes it easier to manage your script and access those variables through the enumerator when things get too much, such as player data (vip,admin,level...etc).

For one off things that aren't related and can't be attached into a group of variables (groups such as player data or vehicle data) you can declare those unique variables in a single shape using 'new' or 'static' depending on the usage.

Does either affect performance? No it's just to not make your project look like spaghetti code.
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link

RogueDrifter is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing in a ENUM interfears with another enum justjamie Scripting Help 9 14/08/2016 07:20 AM
Pawn: enum type in enum sagosagi1 Scripting Help 6 19/05/2014 08:34 AM
Multiple instances of an enum inside an enum Enforcer501 Scripting Help 4 18/06/2013 02:31 PM
Enum tag inside another enum? LarzI Scripting Help 4 19/03/2013 02:10 PM
Enum to check another enum? Lz Scripting Help 4 14/12/2012 06:05 PM


All times are GMT. The time now is 05:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.