SA-MP Forums Archive
Help with new 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: Help with new line! (/showthread.php?tid=358100)



Help with new line! - McCurdy - 09.07.2012

Hey all, i need help in /ad system...

When i advertise some text and that show like this :
Quote:

ADVERTISEMENT: [This is advertisement text] Contact Person: ****_McCurdy (Phone: 9999)

So that is no new line, i want that text show like this :
Quote:

ADVERTISEMENT: [This is advertisement text]
Contact Person: ****_McCurdy (Phone: 9999)

I have been try \n and that is not work so, this is my code :
Код:
//----------------------------------[advertise]-----------------------------------------------
	if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if (IsPlayerInRangeOfPoint(playerid, 5,1490.1304,-1688.8994,15.1903))
	        {
		        if(gPlayerLogged[playerid] == 0)
		        {
		            SendClientMessage(playerid, COLOR_GREY, "** You havent logged in yet !");
		            return 1;
		        }
		        if(PlayerInfo[playerid][pMuted] == 1)
				{
					SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
					return 1;
				}
				new length = strlen(cmdtext);
				while ((idx < length) && (cmdtext[idx] <= ' '))
				{
					idx++;
				}
				new offset = idx;
				new result[128];
				while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
				{
					result[idx - offset] = cmdtext[idx];
					idx++;
				}
				result[idx - offset] = EOS;
				if(!strlen(result))
				{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/ad)vertise [advert text]");
				return 1;
				}
				if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
				{
					format(string, sizeof(string), "** Please try again later %d seconds between Advertisements !",  (addtimer/1000));
					SendClientMessage(playerid, COLOR_GRAD2, string);
					return 1;
				}
				SafeGivePlayerMoney(playerid, -500);
				format(string, sizeof(string), "ADVERTISEMENT: %s Contact Person: %s (Phone: %d)",  result, sendername ,PlayerInfo[playerid][pPnumber]);
				SendClientMessageToAll(COLOR_ORANGE,string);
				GameTextForPlayer(playerid, "~w~Advertisement ~n~~w~Price:~g~$500", 4321,1);
				if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}
				new y,m,d;
				new h,mi,s;
				getdate(y,m,d);
				gettime(h,mi,s);
				format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) %s (Advertisement): %s",d,m,y,h,mi,s, sendername, result);
				ChatLog(string);
			}
            else
			{
				SendClientMessage(playerid, COLOR_GREY,"* You are not in advertisement building!");
				return 1;
			}
			return 1;
		}
		return 1;
	}
In this line i have been try put \n but not work so i delete that :
Quote:

format(string, sizeof(string), "ADVERTISEMENT: %s Contact Person: %s (Phone: %d)", result, sendername ,PlayerInfo[playerid][pPnumber]);

Please somebody help me


Re: Help with new line! - Jstylezzz - 09.07.2012

pawn Код:
format(string, sizeof(string), "ADVERTISEMENT: %s", result);
format(string2,sizeof(string2)," Contact Person: %s (Phone: %d)",sendername ,PlayerInfo[playerid][pPnumber]);
try this
don't forget to add new string2[128];


Re: Help with new line! - Revo - 09.07.2012

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
pawn Код:
format(string, sizeof(string), "ADVERTISEMENT: %s", result);
format(string2,sizeof(string2)," Contact Person: %s (Phone: %d)",sendername ,PlayerInfo[playerid][pPnumber]);
try this
don't forget to add new string2[128];
pls no

pawn Код:
format(string, sizeof(string), "ADVERTISEMENT: %s", result);
SendClientMessage(playerid, -1, string);
format(string,sizeof(string)," Contact Person: %s (Phone: %d)",sendername ,PlayerInfo[playerid][pPnumber]);
SendClientMessage(playerid, -1, string);



Re: Help with new line! - Jstylezzz - 09.07.2012

Quote:
Originally Posted by BuuGhost
Посмотреть сообщение
pls no

pawn Код:
format(string, sizeof(string), "ADVERTISEMENT: %s", result);
SendClientMessage(playerid, -1, string);
format(string,sizeof(string)," Contact Person: %s (Phone: %d)",sendername ,PlayerInfo[playerid][pPnumber]);
SendClientMessage(playerid, -1, string);
OOps, my fault


Re: Help with new line! - Lordzy - 09.07.2012

Mistake:
i f ( I s P l a y e r I n R a n g e O f P o i n t ( p l a y e r i d , 5 , 1 4 9 0
After 5 there should be a dot,not comma[ , ]

Corrected:
i f ( I s P l a y e r I n R a n g e O f P o i n t ( p l a y e r i d , 5 . 1 4 9 0

I don't know whether this is affecting,but i just saw a mistake so i posted.


Re: Help with new line! - Vince - 09.07.2012

Quote:
Originally Posted by [xB]Lordz
Посмотреть сообщение
Mistake:
i f ( I s P l a y e r I n R a n g e O f P o i n t ( p l a y e r i d , 5 , 1 4 9 0
After 5 there should be a dot,not comma[ , ]

Corrected:
i f ( I s P l a y e r I n R a n g e O f P o i n t ( p l a y e r i d , 5 . 1 4 9 0

I don't know whether this is affecting,but i just saw a mistake so i posted.
Uh, no. That is the range.


Re: Help with new line! - McCurdy - 09.07.2012

Quote:
Originally Posted by BuuGhost
Посмотреть сообщение
pls no

pawn Код:
format(string, sizeof(string), "ADVERTISEMENT: %s", result);
SendClientMessage(playerid, -1, string);
format(string,sizeof(string)," Contact Person: %s (Phone: %d)",sendername ,PlayerInfo[playerid][pPnumber]);
SendClientMessage(playerid, -1, string);
how to make that text with color? and is that send to all player? SendClientMessage or SendClientMessageToAll ?


Re: Help with new line! - Jstylezzz - 09.07.2012

SendClientMessageToAll(COLOR_HERE,string);


Re: Help with new line! - McCurdy - 09.07.2012

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
SendClientMessageToAll(COLOR_HERE,string);
thank's dude, i'ts work correctly...thank's for all