//First method. I think that this method is worse than second, because there are some string. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case 477: { if(response) { new string[113],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"Hello! Your name is %s. Your wanted level is %d stars. You have %d dollars.",name,GetPlayerWantedLevel(playerid),GetPlayerMoney(playerid)); SendClientMessage(playerid,-1,string); } } case 1025: { if(response) { new string[128],name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"Hello! Your name is %s. Your wanted level is %d stars. You have %d $. Have a nice day! :)",name,GetPlayerWantedLevel(playerid),GetPlayerMoney(playerid)); SendClientMessage(playerid,-1,string); } } } return 0; } //================================================================================== //Second method. I think that this method is better than first, because it uses only one string. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[128],name[MAX_PLAYER_NAME]; switch(dialogid) { case 477: { if(response) { GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"Hello! Your name is %s. Your wanted level is %d stars. You have %d dollars.",name,GetPlayerWantedLevel(playerid),GetPlayerMoney(playerid)); SendClientMessage(playerid,-1,string); } } case 1025: { if(response) { GetPlayerName(playerid,name,sizeof(name)); format(string,sizeof(string),"Hello! Your name is %s. Your wanted level is %d stars. You have %d $. Have a nice day! :)",name,GetPlayerWantedLevel(playerid),GetPlayerMoney(playerid)); SendClientMessage(playerid,-1,string); } } } return 0; }
Personally, I opt for the second method, but it really doesn't matter. You're optimizing the wrong things.
|
Then, what I need to optimize for better performance and less memory usage?
|
Thank you very much. But is there any tutorial of using JIT? Because I can't understand what this thing does...
![]() |