SA-MP Forums Archive
Format player join. - 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)
+--- Thread: Format player join. (/showthread.php?tid=396146)



Format player join. - Mustafa6155 - 29.11.2012

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?


Re: Format player join. - Mustafa6155 - 29.11.2012

Is GetPlayerName good?


Re: Format player join. - jueix - 29.11.2012

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



Re: Format player join. - Lordzy - 29.11.2012

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



Re: Format player join. - Mustafa6155 - 29.11.2012

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


Re: Format player join. - Hugoca - 29.11.2012

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



Re: Format player join. - Mustafa6155 - 29.11.2012

Still Hugoca


Re: Format player join. - Hugoca - 29.11.2012

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)



Re: Format player join. - ADY26 - 29.11.2012

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


Re: Format player join. - Mustafa6155 - 29.11.2012

Howly i got it still?