Format player join.
#1

Hey guys i got this.
pawn Код:
new string[64];
    format(string,sizeof(string),"[Joined]%s Battlefield 3 server.",playerid));
    SendClientMessageToAll(playerid,0xFFFFFFAA,string);
And i just get Joined and not the name of the player?
Reply
#2

Is GetPlayerName good?
Reply
#3

Quote:
Originally Posted by Mustafa6155
Посмотреть сообщение
Hey guys i got this.
pawn Код:
new string[64];
    format(string,sizeof(string),"[Joined]%s Battlefield 3 server.",playerid));
    SendClientMessageToAll(playerid,0xFFFFFFAA,string);
And i just get Joined and not the name of the player?
pawn Код:
new string[64];    
format(string,sizeof(string),"[Joined]%s Battlefield 3 server.",GetName(playerid));    
SendClientMessageToAll(playerid,0xFFFFFFAA,string);
or

pawn Код:
new string[64];    
format(string,sizeof(string),"[Joined]%s Battlefield 3 server.",GetPlayerName(playerid));    
SendClientMessageToAll(playerid,0xFFFFFFAA,string);
Reply
#4

Well, as ****** said, playerid means the ID of the player. And while it's used it functions, it means that user who gets used by that function. You must use GetPlayerName function to get player's name.

https://sampwiki.blast.hk/wiki/GetPlayerName

Example:
pawn Код:
new Lname[MAX_PLAYER_NAME]; //Creating a name variable.
GetPlayerName(playerid, Lname, sizeof(Lname)); //Gets the player's name with Lname variable executed in it. Sizeof lname means the length of the player name.
new str[60];
format(str, sizeof(str), "Name:%s", Lname); //We can now use the float as Lname instead of GetPlayerName.
SendClientMessage(playerid, -1, str);
Reply
#5

Thanks but...
pawn Код:
SendClientMessageToAll(playerid,0xFFFFFFAA,string);
isnt this good
I got this error?
: error 035: argument type mismatch (argument 2)
Reply
#6

pawn Код:
SendClientMessageToAll(playerid,0xFFFFFFAA,string);
Reply
#7

Still Hugoca
Reply
#8

try to make it

pawn Код:
new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"[Joined]%s Battlefield 3 server.",pName);
    SendClientMessageToAll(0xFFFFFFAA,string)
Reply
#9

pawn Код:
SendClientMessageToAll(0xFFFFFFAA,string);
Playerid shouldn't be in sendclientmessagetoall only in sendclientmessage
Reply
#10

Howly i got it still?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)