SA-MP Forums Archive
Strcat with player name ? - 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 with player name ? (/showthread.php?tid=583265)



Strcat with player name ? - jamesmith12 - 27.07.2015

hello guys i like to show player name in credit dialog when he type credits but i cant heheeh

Код:
CMD:credits(playerid, params[])
{
	new string[516];
	format(string, 516, ""/n);
	strcat(string, "{FFFFFF}BLAH BLAH\n");
	strcat(string, "{FFFFFF}BLAH BLAH\n");
	strcat(string, "{FFFFFF}and thanks to "Playernamehere" for playing here\n");
	ShowPlayerDialog(playerid,128, DIALOG_STYLE_MSGBOX, "Credits", string, "Okay", "");
	return 1;
}
I like to show player name here
Код:
strcat(string, "{FFFFFF}and thanks to "Playernamehere" for playing here\n");



Re: Strcat with player name ? - iTakelot - 27.07.2015

What is your doubt in relation to this?


Re: Strcat with player name ? - jamesmith12 - 27.07.2015

i dont know how to get the player name and put his name on Dialog

for ex : Hi Thank you iTakelot for playing here.


Re: Strcat with player name ? - liquor - 27.07.2015

strcat is for adding a string to another.
You can't show a players name merely by typin "PlayerName".
https://sampwiki.blast.hk/wiki/GetPlayerName


Re: Strcat with player name ? - jamesmith12 - 27.07.2015

Quote:
Originally Posted by liquor
Посмотреть сообщение
strcat is for adding a string to another.
You can't show a players name merely by typin "PlayerName".
https://sampwiki.blast.hk/wiki/GetPlayerName
Yes I know its just an example that i want to put the playername in "PlayerName"


Re: Strcat with player name ? - DarkLored - 27.07.2015

create another string
pawn Код:
new tmp_str[250], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, 24);
format(tmp_str, sizeof(tmp_str), " "{FFFFFF}and thanks to "%s" for playing here\n", name);
strcat(string, tmp_str);
ShowPlayerDialog(playerid,128, DIALOG_STYLE_MSGBOX, "
Credits", string, "Okay", "");



Re: Strcat with player name ? - jamesmith12 - 27.07.2015

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
create another string
pawn Код:
new tmp_str[250], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, 24);
format(tmp_str, sizeof(tmp_str), " "{FFFFFF}and thanks to "%s" for playing here\n", name);
strcat(string, tmp_str);
ShowPlayerDialog(playerid,128, DIALOG_STYLE_MSGBOX, "
Credits", string, "Okay", "");
Nice Bro! Thank you for this help me a lot. +1 Rep


Re: Strcat with player name ? - liquor - 27.07.2015

I linked you to the wiki with a perfect example and you ignored it :P Idc about rep points but i feel /ignored xD


Re: Strcat with player name ? - jamesmith12 - 27.07.2015

Quote:
Originally Posted by liquor
Посмотреть сообщение
I linked you to the wiki with a perfect example and you ignored it :P Idc about rep points but i feel /ignored xD
aaaaaaw Ok bro sorry hahaha +1 rep to you bro ! and thanks too


Re: Strcat with player name ? - jamesmith12 - 27.07.2015

thank you all

its now working i use this code for does who want to do this tooo

Код:
CMD:credits(playerid, params[])
{
	new string[516];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, 550);
	format(string, 516, ""COL_WHITE"1."COL_RED"First of all thanks "COL_GREEN"%s "COL_RED"for playing here\n" ,name);
	strcat(string, ""COL_WHITE"2."COL_GREEN"James Abragona.k.a Jamesmith "COL_RED"(Script Editor)\n");
	ShowPlayerDialog(playerid,128, DIALOG_STYLE_MSGBOX, "Credits", string, "Okay", "");

}