Strcat with player name ?
#1

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");
Reply
#2

What is your doubt in relation to this?
Reply
#3

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

for ex : Hi Thank you iTakelot for playing here.
Reply
#4

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
Reply
#5

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"
Reply
#6

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", "");
Reply
#7

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
Reply
#8

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

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
Reply
#10

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", "");

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)