Join/Leave message for admins - 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: Join/Leave message for admins (
/showthread.php?tid=503130)
Join/Leave message for admins -
lulo356 - 28.03.2014
How can you create a Join/Leave message, I checked Wiki, but my Pawno is crashing from the code.
Do you got maybe one for me
Or do you know what i need to do
Re: Join/Leave message for admins -
RenovanZ - 28.03.2014
pawn Код:
public OnPlayerConnect(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerAdmin(i)) // or you can replace with your admin enum
{
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s joined the server.", name);
SendClientMessage(i, -1, string);
}
}
return 1;
}
Re: Join/Leave message for admins -
Hanuman - 28.03.2014
Above one is connect message!
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
switch (reason) {
case 0:
{
format(str, sizeof(str), "%s (%d) has left the server ~r~[Timeout]", PlayerName, playerid);
}
case 1:
{
format(str, sizeof(str), "%s (%d) has left the server ~r~[Leaving]", PlayerName, playerid);
}
case 2:
{
format(str, sizeof(str), "%s (%d) has left the server ~r~[Kicked or Banned]", PlayerName, playerid);
}
SendClientMessageToAll(-1, str);
}
return 1;
}
And this is your leave message
Re: Join/Leave message for admins -
Diogo123 - 28.03.2014
pawn Код:
stock SendAdminMessage(message[])
{
foreach(Player, i)
{
if(GetPVarInt(i,"Level" ) < 1)
{
SendClientMessage(i,-1,message);
}
else return 0;
}
return 1;
}
example :
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s joined the server.", name);
SendClientMessage(i, -1, string);
SendAdminMessage(string);