Help - 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: Help (
/showthread.php?tid=627241)
Help -
Mijata - 25.01.2017
fIXED
Re: Help -
ThatFag - 25.01.2017
Where did you put those codes ?
and try these if works or nop
Код:
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof(string)," %s has joined the server",pName);
SendClientMessageToAll(-1,string);
Edit: or use this one, should work
Код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
new string[128],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s has joined to the server",pName);
SendClientMessage(i,-1,string);
}
Re: Help -
Codeah - 25.01.2017
Код:
new string[128], pName[MAX_PLAYER_NAME]; // 1
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof(string)," %s has joined the server",pName); // 2
SendClientMessageToAll(-1,string);
1. String is way too big (I recommend 24 since an username can only be 24 chars long.)
2. Missed end quote and sizeof string = sizeof(string)
Re: Help -
Mijata - 25.01.2017
Same situation
Re: Help -
ThatFag - 25.01.2017
Where you putting those codes ?
Re: Help -
Mijata - 25.01.2017
At end of onplayerconnect
Re: Help -
ThatFag - 25.01.2017
Код:
at defines - #define PlayerLoop(%1) for(new %1 = 0, pMax = MAX_PLAYERS; %1 < pMax; %1++) if(IsPlayerConnected(%1) && !IsPlayerNPC(%1))
somewhere in script
Код:
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
OnPlayerConnect
Код:
PlayerLoop(i)
{
new string[128];
format(string,sizeof(string),"% has joined the server" , PlayerName(playerid)
SendClientMessage(i,-1, string);
}
Re: Help -
Mijata - 25.01.2017
fixed