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



strcat - ivndosos - 25.03.2018

why doesn't the strcat part shows ingame?

actually it only shows the %s has connected...


Код:
public OnPlayerConnect(playerid)
{
	new
		String[128],
		PlayerName[MAX_PLAYER_NAME];
		
	GetPlayerName(playerid, PlayerName, sizeof ( PlayerName ));
	
	format(String, sizeof ( String ), "{C3C3C3}GAME: %s has entered the server", PlayerName);
	
	SendClientMessageToAll(-1, String);
	
	new
		 String2[256];
	
	strcat(String2, "{FFCC00}Welcome to GTA Wargounds.");
	strcat(String2, "\n{FFCC00}If you need any help, don't hesitate to ask");
	strcat(String2, "\n{C3C3C3}Here are some commands to get you started");
	strcat(String2, "\n{C3C3C3}/cmds, /help, /rules");
	
	SendClientMessage(playerid,-1,String2);
	
	GameTextForPlayer(playerid, "~w~GTA ~r~ WARGROUNDS", 5000, 6);
	
	return true;
}



Re: strcat - Nru - 25.03.2018

Try this I'm sure it will work.

Код:
public OnPlayerConnect(playerid)
{
	new
		String[128],
		PlayerName[MAX_PLAYER_NAME];

	GetPlayerName(playerid, PlayerName, sizeof ( PlayerName ));

	format(String, sizeof ( String ), "{C3C3C3}GAME: %s has entered the server", PlayerName);

	SendClientMessageToAll(-1, String);

	new
		 String2[256];
	format(string2, sizeof(string2),"{FFCC00}Welcome to GTA Wargounds.\n");
	format(string2, sizeof(string2),"%s{FFCC00}If you need any help, don't hesitate to ask\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}Here are some commands to get you started\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}/cmds, /help, /rules\n",string2);


	SendClientMessage(playerid,-1,String2);

	GameTextForPlayer(playerid, "~w~GTA ~r~ WARGROUNDS", 5000, 6);

	return true;
}



Re: strcat - Gforcez - 25.03.2018

Quote:
Originally Posted by Nru
Посмотреть сообщение
Try this I'm sure it will work.

Код:
public OnPlayerConnect(playerid)
{
	new
		String[128],
		PlayerName[MAX_PLAYER_NAME];

	GetPlayerName(playerid, PlayerName, sizeof ( PlayerName ));

	format(String, sizeof ( String ), "{C3C3C3}GAME: %s has entered the server", PlayerName);

	SendClientMessageToAll(-1, String);

	new
		 String2[256];
	format(string2, sizeof(string2),"{FFCC00}Welcome to GTA Wargounds.\n");
	format(string2, sizeof(string2),"%s{FFCC00}If you need any help, don't hesitate to ask\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}Here are some commands to get you started\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}/cmds, /help, /rules\n",string2);


	SendClientMessage(playerid,-1,String2);

	GameTextForPlayer(playerid, "~w~GTA ~r~ WARGROUNDS", 5000, 6);

	return true;
}
PlayerName is an array, you need to define an index.


Код:
public OnPlayerConnect(playerid)
{
	new
		String[128],
		PlayerName[MAX_PLAYER_NAME];

	GetPlayerName(playerid, PlayerName[playerid], sizeof ( PlayerName[playerid] ));

	format(String, sizeof ( String ), "{C3C3C3}GAME: %s has entered the server", PlayerName[playerid]);

	SendClientMessageToAll(-1, String);

	new
		 String2[256];
	format(string2, sizeof(string2),"{FFCC00}Welcome to GTA Wargounds.\n");
	format(string2, sizeof(string2),"%s{FFCC00}If you need any help, don't hesitate to ask\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}Here are some commands to get you started\n",string2);
	format(string2, sizeof(string2),"%s{C3C3C3}/cmds, /help, /rules\n",string2);


	SendClientMessage(playerid,-1,String2);

	GameTextForPlayer(playerid, "~w~GTA ~r~ WARGROUNDS", 5000, 6);

	return true;
}
Also if you want to keep using PlayerName in the rest of your script, you should make PlayerName a global variable.


Re: strcat - Jefff - 25.03.2018

Read note https://sampwiki.blast.hk/wiki/SendClientMessage


Re: strcat - [WSF]ThA_Devil - 25.03.2018

SendClientMessage can only write to a single line. If you want multiple lines then you need to call SCM again with a different text in it.