has joined server - 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: has joined server (
/showthread.php?tid=470265)
has joined server -
Another1 - 17.10.2013
Код:
new name[MAX_PLAYER_NAME]; new j_msg[20 + MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof (name));
format(j_msg,sizeof (j_msg),"%s has joined server",name);
SCMA(0x808080AA, j_msg);
hello i make this code and its work fine but i want when someone join just the other players see this message "blabla has joined server" not him
Re: has joined server -
arakuta - 17.10.2013
Pass a loop through all players, and check whether the player is himself or not.
pawn Код:
for(new a; a < MAX_PLAYERS; ++a)
{
if(IsPlayerConnected(a) && a != playerid) // if 'a' is connected and not playerid
SendClientMessage(a,0x808080AA,j_msg);
}
Re: has joined server -
zT KiNgKoNg - 17.10.2013
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new str[40], strname[1+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, strname, sizeof(strname));
format(str,sizeof(str),"[Connect]: %s Has connected to the server", strname);
SendClientMessage(i, -1, str);
}
}
Re: has joined server -
Niko_boy - 17.10.2013
Quote:
Originally Posted by zT KiNgKoNg
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new str[40], strname[1+MAX_PLAYER_NAME+1]; GetPlayerName(playerid, strname, sizeof(strname)); format(str,sizeof(str),"[Connect]: %s Has connected to the server", strname); SendClientMessage(i, -1, str); } }
|
that basicly is same as Send message to all
u should do a statement above it to check if index i is not equal to playerid
thats what arukta did , so his answer is appropriate
Re: has joined server -
tyler12 - 17.10.2013
Or use this function:
https://sampforum.blast.hk/showthread.php?pid=94980#pid94980