Need an explanation regarding this
#1

I don't understand what this "format" is used for and how can it be used later in the script?

Code:
        new name_of_server[42];
	format(name_of_server, sizeof(name_of_server), "hostname %s v. %.01f", SERVER_NAME, SERVER_VERSION);
	SendRconCommand(name_of_server);
I'll very grateful if anyone can give me a good explanation of this piece of code, how it works and so on.

Thank you.
Reply
#2

pawn Code:
new name_of_server[42]; // declare the hostname variable.
    format(name_of_server, sizeof(name_of_server), "hostname %s v. %.01f", SERVER_NAME, SERVER_VERSION); // format the hostname variable string with the RCON command name, server name and version =
    SendRconCommand(name_of_server); // send the RCON command to the server setting the hostname of the server.
Reply
#3

Quote:

Formats a string to include variables and other strings inside it.

you should check this https://sampwiki.blast.hk/wiki/Format
Reply
#4

okay, lets make it simple.
You can't send a message (and not only a message) with a formatted, such as "Hello Hooligan12"
you must format this like - format(text,sizeof(text),"Hello %s",YourNameScript), SendClientMessage(playerid,-1,text);

Yeah u can use this SendClientMessage(playerid,-1,"Hello Hooligan12"); too but u're saying hello only yourself, if someone got this message it only says your name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)