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