SA-MP Forums Archive
Welcome, 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Welcome, Name (/showthread.php?tid=151271)



Welcome, Name - Ihsan_Cingisiz - 29.05.2010

Hello
I'm stuck with one thing, i don't know how to
greet someone with his Name. I see on any
GM's Welcome to ...., %s, and in-game is displays
Welcome Name. What do i exactly need to do?


Re: Welcome, Name - Retardedwolf - 29.05.2010

You need to search and wiki.

pawn Код:
public OnPlayerConnect(playerid)
{
  new string[64], pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  format(string,sizeof string,"%s has joined the server. Welcome!",pName);
  SendClientMessageToAll(0xFFFFFFAA,string);
  return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerConnect


Re: Welcome, Name - (SF)Noobanatior - 29.05.2010

pawn Код:
new str[128],playername[MAX_PLAYERNAME];//vars to store info
GetPlayerName(playerid,playername,sizeof(playername));
format(str,sizeof(str),"Welcome %s to ........",playername); //where %s is string %d a number and %f a float(decimal)
SendClientMessage(playerid,colour,str);



Re: Welcome, Name - Sergei - 29.05.2010

pawn Код:
public OnPlayerConnect(playerid)
{
   new string[34]; GetPlayerName(playerid,string,MAX_PLAYER_NAME);
   format(string,sizeof(string),"Welcome %s.",string); SendClientMessage(playerid,0xFFFFFFFF,string);
   return 1;
}