Welcome, Name
#1

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?
Reply
#2

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

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)