SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 12/09/2017, 06:59 AM   #1
skiplovebra
Huge Clucker
 
Join Date: Sep 2015
Posts: 282
Reputation: 0
Default dialog log server ?

Hi everyone is a newbie I want to ask #define many server dialogs are lag behind and how to set the correct dialog?

skiplovebra is offline   Reply With Quote
Old 12/09/2017, 07:20 AM   #2
Zeth
Huge Clucker
 
Zeth's Avatar
 
Join Date: Feb 2017
Location: Titan
Posts: 428
Reputation: 114
Default Re: dialog log server ?

Better use enums
PHP Code:
enums
{
yourdialog0,
yourdialog1,
yourdialog2
}; 
Zeth is offline   Reply With Quote
Old 12/09/2017, 09:26 AM   #3
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,071
Reputation: 281
Default Re: dialog log server ?

Quote:
Originally Posted by Debjit View Post
Better use enums
PHP Code:
enums
{
yourdialog0,
yourdialog1,
yourdialog2
}; 
Enums are stored in the memory, you don't want to use that much memory for something so simple, I recommend you to keep the #define way you're using, It will increase the compilation time, however, dialog ids won't be stored in the memory.
__________________

|===[Web taxi]===|
List of my work
Github
Pastebin

|===[Interesting topics]===|
Semantic Versioning
Eoussama is offline   Reply With Quote
Old 12/09/2017, 11:01 AM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: dialog log server ?

Are you sure about that? Enum specifiers are constants, not variables. They also have the added benefit that an ID is never used twice and that you can reorder the specifiers without having to change the IDs manually. And even if you had 5000 specifiers you'd be looking at a mere 20 kilobytes. Wow, so much memory! /s
__________________
Vince is offline   Reply With Quote
Old 12/09/2017, 11:34 AM   #5
JasonRiggs
Gangsta
 
Join Date: Jul 2016
Location: My bedroom.
Posts: 780
Reputation: 47
Default Re: dialog log server ?

It won't lag in game, it might lag the compiler, although, You are defining it the right way, and if you want to not have this lag problem, You can delete that define and just use its ID in ShowPlayerDialog, And store the ID in a notepad on your pc or something.
__________________
JasonRiggs is offline   Reply With Quote
Old 12/09/2017, 12:28 PM   #6
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,652
Reputation: 559
Default Re: dialog log server ?

Quote:
Originally Posted by JasonRiggs View Post
It won't lag in game, it might lag the compiler, although, You are defining it the right way, and if you want to not have this lag problem, You can delete that define and just use its ID in ShowPlayerDialog, And store the ID in a notepad on your pc or something.
That is the worst thing I've ever read on here. Okay kidding, not that bad, but still...

Just use defines if you're cool with re-ordering them once in a while (or leave some free ids between each, either way that's totally cool and will not "lag" anything).

Use enums if you want to make it simple (because it really is the most simple thing regarding this - and it will not "lag" your server or compiler).


Neither is going to influence the speed of the server, and the compile time difference between actual numbers, defines and enumerations is negligible.

As Vince said, enums are constants.

Code:
enum
{
test
};
and

Code:
#define test 0
are exactly the same after compiling. Even using enumerations for arrays is nothing else than a constant number replaced with a word which is easier for us humans to read (tags (or data types) also aren't neccessary to declare in enums, but it's just easier for us)...

An enum as suchs doesn't even exist after compiling.
NaS 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
[DIALOG]How i Create A dialog Whent Player Login To Enter in Dialog The Password donhu789 Scripting Help 8 29/09/2013 08:15 AM
[FilterScript] Server Control Panel V1.0.0 - A simple server control filterscript with dialog chencong Filterscripts 10 27/09/2013 08:31 PM
Server Dialog ASSASSINATION Scripting Help 5 12/04/2013 03:44 PM
Dialog boxes in the server! Goldino Scripting Help 0 11/12/2012 04:25 PM
Server Crash - DIALOG Kohva Help Archive 13 01/11/2009 11:42 AM


All times are GMT. The time now is 03:43 AM.


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