SA-MP Forums Archive
Quick question about definitions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick question about definitions (/showthread.php?tid=298253)



Quick question about definitions - Scarred - 19.11.2011

I'm trying to do something like this -

pawn Код:
#define     SCRIPT:VERSION      0.1
#define     SCRIPT:MODE         "Virtual DM"
However, I'm receiving errors

Quote:
Originally Posted by PAWNO
(6) : warning 201: redefinition of constant/macro (symbol "SCRIPT:MODE")
(16) : error 017: undefined symbol "VERSION"
Will this even work? And if so, is there a fix for these errors? I'd appreciate a quick response as this throws everything off, and I would really like to be able to code like that, as it's very organized.


Respuesta: Quick question about definitions - kirk - 19.11.2011

Dont use : on your defines or variables, do it like this:

SCRIPT_VERSION 0.1
SCRIPT_MODE "Vitual DM"


Re: Quick question about definitions - Scarred - 19.11.2011

Alright, so colons will not work in definitions. That's all I wanted to know; Thank you.


Re: Quick question about definitions - Sinc - 20.11.2011

Quote:
Originally Posted by Scarred
Посмотреть сообщение
Alright, so colons will not work in definitions. That's all I wanted to know; Thank you.
Incorrect.

Код:
(6) : warning 201: redefinition of constant/macro (symbol "SCRIPT:MODE")
'SCRIPT:MODE' has already been defined. This may be whether in an included directive, or somewhere within your script.


Re: Quick question about definitions - DRIFT_HUNTER - 20.11.2011

Labels dont work with definitions
pawn Код:
#define Dialog:                 _:DIALOG_

enum DIALOG
    {
        Dialog:Empty    0,          Dialog:Register     1,  Dialog:Login       2,//And so on
    }


//Now you can use them as variables for example:
ShowPlayerDialog(playerid, Dialog:Login,.....
I learned these from Zh3r0 so credits goes to him