Simple Optimization help
#1

pawn Код:
CMD:jobstats(playerid, params[])
{
    new string1[40], string2[40], string3[40], string4[40], string5[40], string6[40];
   
    SendClientMessage(playerid, COLOR_YELLOW, "_______________________");
    format(string1, sizeof(string1), "Mechanic:       Level %i",PlayerInfo[playerid][pJobLvl1]);
    format(string2, sizeof(string2), "Trash Truck:   Level %i",PlayerInfo[playerid][pJobLvl2]);
    format(string3, sizeof(string3), "Taxi Driver:     Level %i",PlayerInfo[playerid][pJobLvl3]);
    format(string4, sizeof(string4), "Truck Driver:  Level %i",PlayerInfo[playerid][pJobLvl4]);
    format(string5, sizeof(string5), "Mail Delivery:  Level %i",PlayerInfo[playerid][pJobLvl5]);
    format(string6, sizeof(string6), "Arms Dealer:  Level %i",PlayerInfo[playerid][pJobLvl6]);
    SendClientMessage(playerid, COLOR_YELLOW, string1);
    SendClientMessage(playerid, COLOR_YELLOW, string2);
    SendClientMessage(playerid, COLOR_YELLOW, string3);
    SendClientMessage(playerid, COLOR_YELLOW, string4);
    SendClientMessage(playerid, COLOR_YELLOW, string5);
    SendClientMessage(playerid, COLOR_YELLOW, string6);
    return 1;
}

I was hoping somebody could help me optimize this set of code. I just wrote this as an example, But I was thinking of ways of optimizing it down for learning purposes to a single string and a single 'SendClientMessage' to produce the same result. None of my theories are working exactly as I thought they would. Any help please? I'm sure it is a simple thing I am missing myself. Thanks in advance!
Reply


Messages In This Thread
Simple Optimization help - by DevHarden - 28.09.2016, 06:06
Re: Simple Optimization help - by DTV - 28.09.2016, 07:02
Re: Simple Optimization help - by Dutheil - 28.09.2016, 10:20
Re: Simple Optimization help - by K0P - 28.09.2016, 10:32
Re: Simple Optimization help - by Dutheil - 28.09.2016, 10:37
Re: Simple Optimization help - by DevHarden - 28.09.2016, 11:43

Forum Jump:


Users browsing this thread: 2 Guest(s)