SA-MP Forums Archive
two lines - 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: two lines (/showthread.php?tid=628245)



two lines - StR_MaRy - 08.02.2017

hey guys i have this close report command but i want to give a bigger reason when i close a report... and i want to show the reason in 2 lines if the reason is to big the cmd is this but isn't working ... just 1 line after 200 letters it stop and is only 1 line.

Код HTML:
CMD:declinereport(playerid, params[])
{
	new splayer[25], giveplayerid, reason[32], string2[200];
	if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_ERROR, "Nu ai gradul necesar ca sa folosesti aceasta comanda!");
    if(PlayerInfo[playerid][pTreedSecurity] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Nu ai gradul necesar ca sa folosesti aceasta comanda!");
	if(sscanf(params,"s[25]s[32]",splayer, reason)) return SendClientMessage(playerid, COLOR_SYN, "Sintaxa:{FFFFFF} (/d)ecline®eport <Player ID/Name> <reason>");
	{
	    if(GetPlayers(splayer) == INVALID_PLAYER_ID) return InvalidPlayer(playerid);
	    else if(GetPlayers(splayer) == 1000) return ToManyResults(playerid);
	    else if(GetPlayers(splayer) == 1001) return ShowResults(playerid, splayer);
	    else giveplayerid = GetPlayers(splayer);

		if(HasReported[giveplayerid] == 0) return SendClientMessage(playerid, COLOR_SYN2, "Acel jucator nu a trimis un report.");

		HasReported[giveplayerid] = 0;
        format(PlayerInfo[giveplayerid][pReport],164," ");
        
        format(gString, sizeof(gString), "Ai respins reportul jucatorului %s, motiv: %s", GetName(giveplayerid), reason);
	    SendClientMessage(playerid, COLOR_NOB, gString);
	    if(strlen(gString) > 200)
	    {
	    	strmid(string2, gString, 110, 256);
	        strdel(gString, 110, 256);

		    format(gString,200,"{00CC00}%s ...",gString);
		    ABroadCast(COLOR_NEWS2, gString, 1);

		    format(string2,200,"{00CC00}... %s",string2);
		    ABroadCast(COLOR_NEWS2, string2, 1);
	    }

	    format(gString, sizeof(gString), "Adminul %s ti-a respins reportul, motiv: %s", GetName(playerid), reason);
		if(strlen(gString) > 200)
	    {
	    	strmid(string2, gString, 110, 256);
	        strdel(gString, 110, 256);

		    format(gString,200,"{00CC00}%s ...",gString);
		    ABroadCast(COLOR_NEWS2, gString, 1);

		    format(string2,200,"{00CC00}... %s",string2);
		    ABroadCast(COLOR_NEWS2, string2, 1);
	    }
	    Reports--;
	    UpdateStaffTextdraw();
	}
    return 1;
}
any idea why.. ?


Re: two lines - JesterlJoker - 08.02.2017

PHP код:
 string2[200
set this to a higher array


Re: two lines - StR_MaRy - 08.02.2017

still wont work , i edited to 500 and still didn't show


Re: two lines - Vince - 08.02.2017

Maximum chat output is 144 characters, anyway, so anything larger than that is a waste. But given that you have set a maximum buffer of 32 for the "reason" parameter the entire string doesn't even exceed 100 characters. Your "greater than 200" check evaluates to false and there is nothing to fall back to which means the ABroadcast doesn't get sent at all.


Re: two lines - Donboo - 08.02.2017

There is a stock - SendSplitMessage. It splits your message in 2 lines.

Код:
stock SendSplitMessage(playerid, color, const final[])
{
    new buffer[EX_SPLITLENGTH+5];
    new len = strlen(final);
    if(len>EX_SPLITLENGTH)
    {
        new times = (len/EX_SPLITLENGTH);
        for(new i = 0; i < times+1; i++)
        {
            strdel(buffer, 0, EX_SPLITLENGTH+5);
            if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
                format(buffer, sizeof(buffer), "%s ...", buffer);
            }
            else
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, len);
            }
            SendClientMessage(playerid, color, buffer);
        }
    }
    else
    {
        SendClientMessage(playerid, color, final);
    }
    return 1;
}
And you can use it like that:

Код:
format(gString, sizeof(gString), "Ai respins reportul jucatorului %s, motiv: %s", GetName(giveplayerid), reason);
SendSplitMessage(playerid, COLOR_NOB, gString);
And if you use it like
/closereport 0 Your message was deleted by an admin because of etc1 etc2 etc3 etc4 etc5 etc6

Your message will look like
Ai respins reportul jucatorului Player, motiv: Your message was deleted..
..by an admin because of etc1 etc2 etc3 etc4 etc5 etc6


Pe pawno.ro nu vrei sa intrebi? E mai usor pe .com?


Re: two lines - GoldenLion - 08.02.2017

Quote:
Originally Posted by Donboo
Посмотреть сообщение
There is a stock
https://sampforum.blast.hk/showthread.php?tid=570635


Re: two lines - StR_MaRy - 08.02.2017

Thx i did something like that... but you forgot to put
Код HTML:
#define EX_SPLITLENGTH 150
and i don't understand that
Код HTML:
Pe pawno.ro nu vrei sa intrebi? E mai usor pe .com?



Re: two lines - StR_MaRy - 08.02.2017

still isn't working ... can someone have any idea :-s ?