String.
#1

What's better, or just what's the best way and why should i choose this way. Is there any differences, or i just have to take care of number of cells ?

Код:
new globalstring[ 1024 ];
Код:
format(globalstring, sizeof(globalstring), "Hello %s, Welcome to SA:MP", playername);
Код:
new string[ 80 ];
Код:
format(string, sizeof(string), "Hello %s, Welcome to SA:MP", playername);
Код:
new string[ 25 + MAX_PLAYER_NAME ];
Код:
format(string, sizeof(string), "Hello %s, Welcome to SA:MP", playername);
Reply
#2

I'll be your hero!



This is how the correct way would be in any scripting language.



PHP код:
// define a macro telling us a 'English' version of a message that's visible to a client, preferably in a seperate file in the includes folder.
#define MESSAGE_TEST
    
"Hello %s, this is some weird shit."
// and then the usage is:
const ShowTestMessage(playerid) {
    static 
cells[sizeof(MESSAGE_TEST)+MAX_PLAYER_NAME];
    static 
userName[MAX_PLAYER_NAME];
    
GetPlayerName(playeriduserNamesizeof(userName));
    
format(cellssizeof cellsMESSAGE_TESTuserName);
    return 
cells;









im a smartass
Reply
#3

The second way is better.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)