26.02.2010, 17:36
Hi. I deleting "_" from nick, and I question what is more optimal for the server. I mean load.
First way:
second way:
First way:
Код:
new name[MAX_PLAYER_NAME]; new name_split[3][MAX_PLAYER_NAME]; new string[128]; GetPlayerName(playerid,name,sizeof(name)); split(name,name_split,'_'); format(string,sizeof(string),"Hi %s %s",name_split[0],name_split[1]); SendClientMessage(playerid,some_color,string);
Код:
stock SomeFunction(name[]) { for(new i = 0; name[i] != 0; i++) if(name[i] == '_') name[i] = ' '; } new name[MAX_PLAYER_NAME]; new string[128]; GetPlayerName(playerid,name,sizeof(name)); SomeFunction(name); format(string,sizeof(string),"Hi %s",name); SendClientMessage(playerid,some_color,string);