SA-MP Forums Archive
Define Colors. - 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: Define Colors. (/showthread.php?tid=612244)



Define Colors. - FrAnKiN1 - 15.07.2016

Hey guys when i try to define those colors i get error
gamemodes\Blank.pwn(9) : error 049: invalid line continuation


Код:
//====|Colors|====\\
#define C_RED        "{FF0000}"
#define Blue           "{007CFF}"
#define Green         "{01FD23}"
#define Yellow        "{FDF901}"
#define Orange       "{FFD330}"
#define Purple        "{F630FF}"
#define Aqua          "{30FFF9}"
#define White         "{FFFFFF}"
//============================



Re: Define Colors. - Konstantinos - 15.07.2016

Remove \\ from the first line.


Re: Define Colors. - FrAnKiN1 - 15.07.2016

Worked but why didnt work with it?


Re: Define Colors. - Quinncell - 15.07.2016

Since you made those code lines a comment.
PHP код:
//====|Colors|====\\
#define C_RED        "{FF0000}"
#define Blue           "{007CFF}"
#define Green         "{01FD23}"
#define Yellow        "{FDF901}"
#define Orange       "{FFD330}"
#define Purple        "{F630FF}"
#define Aqua          "{30FFF9}"
#define White         "{FFFFFF}" 
this is fine for e.g


Re: Define Colors. - Quinncell - 15.07.2016

Btw, you don't need to define hex colors, they work even if they're not defined.


Re: Define Colors. - FrAnKiN1 - 15.07.2016

Quote:
Originally Posted by KeithCooper
Посмотреть сообщение
Btw, you don't need to define hex colors, they work even if they're not defined.
u mean i can remove them btw i want write letters its better for me


Re: Define Colors. - Konstantinos - 15.07.2016

Quote:
Originally Posted by FrAnKiN1
Посмотреть сообщение
Worked but why didnt work with it?
Backslash is used to "join" the code from the next line. Few examples:
PHP код:
new string[] = "This is some \
    string"

or
PHP код:
#define strcpy(%0,%1) \
    
strcat((%0[0] = EOS, %0), %1
So using it in your initial code somehow tries to continue the comment to the next line which is invalid.

Quote:
Originally Posted by KeithCooper
Посмотреть сообщение
Btw, you don't need to define hex colors, they work even if they're not defined.
Definitions are used to be more user-friendly instead of memorizing hexadecimals for each color.


Re: Define Colors. - FrAnKiN1 - 15.07.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Backslash is used to "join" the code from the next line. Few examples:
PHP код:
new string[] = "This is some \
    string"

or
PHP код:
#define strcpy(%0,%1) \
    
strcat((%0[0] = EOS, %0), %1
So using it in your initial code somehow tries to continue the comment to the next line which is invalid.



Definitions are used to be more user-friendly instead of memorizing hexadecimals for each color.
Okay that was helpful for me and thanks for helping.