SA-MP Forums Archive
Is this good or not? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is this good or not? (/showthread.php?tid=442436)



Is this good or not? - superaconi - 07.06.2013

Is this command is good or not if it isnt good can you make me better?

pawn Код:
if (strcmp(cmd, "/weaponskills", true)
    {
        format(string, sizeof(string), "Colt : %s", PlayerInfo[targetid][pPistSkill]);
        SendClientMessage(playerid, COLOR_WHITE,string);
        format(string, sizeof(string), "Silenced Colt : %s", PlayerInfo[targetid][pSilenSkill]);
        SendClientMessage(playerid, COLOR_GRAD2,string);
        format(string, sizeof(string), "Deagle : %s", PlayerInfo[targetid][pDesertSkill]);
        SendClientMessage(playerid, COLOR_GRAD3,string);
        format(string, sizeof(string), "Shotgun : %s", PlayerInfo[targetid][pShotgSkill]);
        SendClientMessage(playerid, COLOR_GRAD4,string);
        format(string, sizeof(string), "Sawn : %s", PlayerInfo[targetid][pSawnSkill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
        format(string, sizeof(string), "Combat : %s", PlayerInfo[targetid][pCombSkill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
        format(string, sizeof(string), "Uzi : %s", PlayerInfo[targetid][pUziSkill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
        format(string, sizeof(string), "Smg : %s", PlayerInfo[targetid][pSmgSkill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
        format(string, sizeof(string), "M4 : %s", PlayerInfo[targetid][pM4Skill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
        format(string, sizeof(string), "Ak47 : %s", PlayerInfo[targetid][pAkSkill]);
        SendClientMessage(playerid, COLOR_GRAD5,string);
    }
Sry for bad english :P


Re: Is this good or not? - gtakillerIV - 07.06.2013

Why not just format 1 string with all of these messages and create a line break(\n) in each line ?


Re: Is this good or not? - IceBilizard - 07.06.2013

why not like this?

pawn Код:
if (strcmp(cmd, "/weaponskills", true)
{
  new string[250];
  format(string, sizeof(string), "Colt : %s\nSilenced Colt : %s\nDeagle : %s\nShotgun : %s\nSawn : %s\nCombat : %s\nUzi : %s\nSmg : %s\nM4 : %s\nAk47 : %s", PlayerInfo[targetid][pPistSkill]PlayerInfo[targetid][pSilenSkill],PlayerInfo[targetid][pDesertSkill], PlayerInfo[targetid][pShotgSkill], PlayerInfo[targetid][pSawnSkill], PlayerInfo[targetid][pCombSkill], PlayerInfo[targetid][pUziSkill], PlayerInfo[targetid][pSmgSkill], PlayerInfo[targetid][pM4Skill], PlayerInfo[targetid][pAkSkill]);
SendClientMessage(playerid, COLOR_WHITE,string);
}



Re: Is this good or not? - superaconi - 09.06.2013

Thank you.


Re: Is this good or not? - MP2 - 09.06.2013

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
Why not just format 1 string with all of these messages and create a line break(\n) in each line ?
SCM doesn't support line breaks.