SA-MP Forums Archive
Increase size of a Line - 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: Increase size of a Line (/showthread.php?tid=324766)



Increase size of a Line +REP - TimKen - 10.03.2012

I am trying to put the command /admins on more lines when there are more admins.
For example if there are 3 admins everything is fine with the line.
If there are 4, the 4th's name is half-shown.
This is the command
Код:
dcmd_admins(playerid,params[])
{
	#pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
		if(AccInfo[playerid][Level] >= 0)
		{
	 		new bool:First2 = false;
	 		new Count, i;
		    new string[128];
			new adminname[MAX_PLAYER_NAME];
		    for(i = 0; i < MAX_PLAYERS; i++)
			if(IsPlayerConnected(i) && AccInfo[i][Level] > 0)
			Count++;

			if(Count == 0)
			return SendClientMessage(playerid,red, "No admins online.");

		    for(i = 0; i < MAX_PLAYERS; i++)
			if(IsPlayerConnected(i) && AccInfo[i][Level] > 0)
			{
				if(AccInfo[i][Level] > 0)
				{
					switch(AccInfo[i][Level])
    				{
					case 1: AccType = "Tester";
					case 2: AccType = "Mod";
					case 3: AccType = "Admin";
					case 4: AccType = "{05BDFA}Leader{FF0000}";
					case 5: AccType = "{05BDFA}Manager/Owner{FF0000}";
					}
				}
 				GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2)
				{
					format(string, sizeof(string), "{05BDFA}Online admins:{FF0000} %s [%s]", PlayerName2(i),AccType);
					First2 = true;
				}
   					else format(string,sizeof(string),"%s, %s [%s]",string, PlayerName2(i),AccType);
	        }
		    return SendClientMessage(playerid,red,string);
		}
		else return ErrorMessages(playerid, 1);
	}
	else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}



Re: Increase size of a Line - TimKen - 11.03.2012

bumb please help
+rep if you help


Re: Increase size of a Line - Andi_Evandy - 11.03.2012

try to increase this string:
pawn Код:
new string[128];
example:
pawn Код:
new string[256];



Re: Increase size of a Line - MP2 - 11.03.2012

Client messages can not be longer than 128 characters. Use two lines.


Re: Increase size of a Line - TimKen - 11.03.2012

Quote:
Originally Posted by MP2
Посмотреть сообщение
Client messages can not be longer than 128 characters. Use two lines.
I know this. But i don't know how to put on two lines when Char limit reaches
Now it's:
Admins online: Name[LEVEL], Name[LEVEL], Name[LEVEL], Nam(Cause the Char limit)
I'd like to do it like
Admins Online: Name[LEVEL], Name[LEVEL], Name[LEVEL],
Admins Online: Name[LEVEL]


Re: Increase size of a Line - TimKen - 11.03.2012

Bump Please Help ++REP


Re: Increase size of a Line - SimonItaly - 11.03.2012

I've thought about something like this, untested.

Код:
dcmd_admins(playerid,params[])
{
	#pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
		if(AccInfo[playerid][Level] >= 0)
		{
	 		new Count, i;
		    new string[128] = "{05BDFA}Online admins:{FF0000}", adminname[MAX_PLAYER_NAME], AccType[30];
		    for(i = 0; i < MAX_PLAYERS; i++)
		    {
				if(IsPlayerConnected(i) && AccInfo[i][Level] > 0)
				{
					Count++;
					switch(AccInfo[i][Level])
    				{
						case 1: AccType = "Tester";
						case 2: AccType = "Mod";
						case 3: AccType = "Admin";
						case 4: AccType = "{05BDFA}Leader{FF0000}";
						case 5: AccType = "{05BDFA}Manager/Owner{FF0000}";
					}
	 				GetPlayerName(i, adminname, sizeof(adminname));
					format(string, sizeof(string), "%s %s [%s]", string, adminname, AccType);
					if(strlen(string) > 100)
					{
					    SendClientMessage(playerid, 0xFFFFFFFF, string);
					    strmid(string, "{05BDFA}Online admins:{FF0000}", 0, sizeof(string));
					}
				}
	        }
			if(Count == 0) SendClientMessage(playerid,red, "No admins online.");
		}
		else ErrorMessages(playerid, 1);
	}
	else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
	return 1;
}



Re: Increase size of a Line - TimKen - 12.03.2012

Quote:
Originally Posted by DarkSlyder
Посмотреть сообщение
I've thought about something like this, untested.

Код:
dcmd_admins(playerid,params[])
{
	#pragma unused params
	if(AccInfo[playerid][LoggedIn] == 1)
	{
		if(AccInfo[playerid][Level] >= 0)
		{
	 		new Count, i;
		    new string[128] = "{05BDFA}Online admins:{FF0000}", adminname[MAX_PLAYER_NAME], AccType[30];
		    for(i = 0; i < MAX_PLAYERS; i++)
		    {
				if(IsPlayerConnected(i) && AccInfo[i][Level] > 0)
				{
					Count++;
					switch(AccInfo[i][Level])
    				{
						case 1: AccType = "Tester";
						case 2: AccType = "Mod";
						case 3: AccType = "Admin";
						case 4: AccType = "{05BDFA}Leader{FF0000}";
						case 5: AccType = "{05BDFA}Manager/Owner{FF0000}";
					}
	 				GetPlayerName(i, adminname, sizeof(adminname));
					format(string, sizeof(string), "%s %s [%s]", string, adminname, AccType);
					if(strlen(string) > 100)
					{
					    SendClientMessage(playerid, 0xFFFFFFFF, string);
					    strmid(string, "{05BDFA}Online admins:{FF0000}", 0, sizeof(string));
					}
				}
	        }
			if(Count == 0) SendClientMessage(playerid,red, "No admins online.");
		}
		else ErrorMessages(playerid, 1);
	}
	else SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
	return 1;
}
Thanks, but now when i type /admins it doesn't show up anything


Re: Increase size of a Line - Mike_Peterson - 13.03.2012

Quote:
Originally Posted by TimKen
Посмотреть сообщение
I know this. But i don't know how to put on two lines when Char limit reaches
Now it's:
Admins online: Name[LEVEL], Name[LEVEL], Name[LEVEL], Nam(Cause the Char limit)
I'd like to do it like
Admins Online: Name[LEVEL], Name[LEVEL], Name[LEVEL],
Admins Online: Name[LEVEL]
Err? something like this?
pawn Код:
new str[128]
GetPlayerName(i,name,sizeof(name));
format(str,sizeof(str),"%s[%d], %s[%d], %s[%d]\n",name,PlayerInfo[i][AdminLevel],name,PlayerInfo[i][AdminLevel],name,PlayerInfo[i][AdminLevel]);
dont expect it to work, just showing the \n (newline) thingy.


Re: Increase size of a Line - TimKen - 13.03.2012

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
Err? something like this?
pawn Код:
new str[128]
GetPlayerName(i,name,sizeof(name));
format(str,sizeof(str),"%s[%d], %s[%d], %s[%d]\n",name,PlayerInfo[i][AdminLevel],name,PlayerInfo[i][AdminLevel],name,PlayerInfo[i][AdminLevel]);
dont expect it to work, just showing the \n (newline) thingy.
Ok i used your code and used all my admin script variables for it and it compiled fine.
Now when there will be more admins for testing it i will Tell you if it worked
Thanks for your help +Rep