Defining server name and printing it - 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: Defining server name and printing it (
/showthread.php?tid=546293)
Defining server name and printing it -
Sellize - 14.11.2014
How can I define the server name at the top of the script and use that name throughout the script?
So that I can change 1 variable and the server name will be changed in the whole script
Re: Defining server name and printing it -
GGRoleplay - 14.11.2014
#define SERVERNAME "servername"
and then use SERVERNAME instead of like "servername"
Re: Defining server name and printing it -
dominik523 - 14.11.2014
Код:
#define SERVER_NAME "MyAwesomeServer"
main()
{
printf("%s", SERVER_NAME);
}
Re: Defining server name and printing it -
Sellize - 14.11.2014
Thanks y'all.
Re: Defining server name and printing it -
dominik523 - 14.11.2014
Quote:
Originally Posted by ******
Better:
pawn Код:
const stock SERVER_NAME[] = "MyAwesomeServer";
Otherwise you are making hundreds of copies of the string instead of just referencing the same copy all the time.
|
That is very smart, thanks for pointing that out.