SA-MP Forums Archive
OnPlayerConnect 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: OnPlayerConnect help (/showthread.php?tid=513385)



OnPlayerConnect help - TazmaNiax - 16.05.2014

hi guys i want create admin connect msg like this
Код:
Administrator %s Has been joined the server.
i'm using
Код:
pInfo[playerid][Admin]
plz help~


Re: OnPlayerConnect help - Laure - 16.05.2014

Mhmm alright add this one should work.
pawn Код:
new string[128];
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "Server: You are logged in as level %d administrator", PlayerInfo[playerid][pAdmin]);
    SendClientMessage(playerid, COLOR_WHITE, string);
}



Re: OnPlayerConnect help - TazmaNiax - 16.05.2014

SendClientMessageToAll not SendClientMessage
Код:
Administrator %s Has been joined the server



Re: OnPlayerConnect help - Laure - 16.05.2014

If you want to notify everyone one an admin log then just replace SendClientMessage with SendClientMessageToAll.


Re: OnPlayerConnect help - Affan - 16.05.2014

Edited:

pawn Код:
new string[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
    format(string, sizeof(string), "Server: You are logged in as level %d administrator", PlayerInfo[playerid][pAdmin]);
    SendClientMessage(playerid, COLOR_WHITE, string);
}

Remember to put this after loading player's data.


Re: OnPlayerConnect help - Laure - 16.05.2014

If not then you can still do it under LoadChar.


Re: OnPlayerConnect help - SAMProductions - 16.05.2014

Quote:
Originally Posted by Affan
Посмотреть сообщение
pawn Код:
new string[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
    format(string, sizeof(string), "Server: You are logged in as level %d administrator", PlayerInfo[playerid][pAdmin]);
    SendClientMessageToAll( COLOR_WHITE, string);
}
Remember to put this after loading player's data.
If you use that with SendClientMessageToAll some others will react "w0ah, i am logged in as Administrator",
it is because of "Server: You are logged in as level %d administrator".

Like this (?) :-

(SendClientMessage)
pawn Код:
new string[128];
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "Server: You are logged in as Level %d Administrator", PlayerInfo[playerid][pAdmin]);
    SendClientMessage(playerid, -1, string);
}
(SendClientMessageToAll)
pawn Код:
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "Administrator %s Has been joined the server", pName);
    SendClientMessage(-1, string);
}
(Fresh SendClientMessageToAll)
pawn Код:
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "{FFFFFF}Level %d Administrator {%06x}%s(%d) {FFFFFF}Has been joined the server", PlayerInfo[playerid][pAdmin], (GetPlayerColor(playerid) >>> 8), pName, playerid);
    SendClientMessage(-1, string);
}



Re: OnPlayerConnect help - Affan - 16.05.2014

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
If you use that with SendClientMessageToAll some others will react "w0ah, i am logged in as Administrator",
it is because of "Server: You are logged in as level %d administrator".

Like this (?) :-

(SendClientMessage)
pawn Код:
new string[128];
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "Server: You are logged in as Level %d Administrator", PlayerInfo[playerid][pAdmin]);
    SendClientMessage(playerid, -1, string);
}
(SendClientMessageToAll)
pawn Код:
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "Administrator %s Has been joined the server", pName);
    SendClientMessage(-1, string);
}
(Fresh SendClientMessageToAll)
pawn Код:
new string[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerInfo[playerid][pAdmin])
{
    format(string, sizeof(string), "{FFFFFF}Level %d Administrator {%06x}%s(%d) {FFFFFF}Has been joined the server", PlayerInfo[playerid][pAdmin], (GetPlayerColor(playerid) >>> 8), pName, playerid);
    SendClientMessage(-1, string);
}
Oh yeah, I forgot. Thank you.


Re: OnPlayerConnect help - SAMProductions - 16.05.2014

Just replace,
Код:
if(PlayerInfo[playerid][pAdmin])
Код:
PlayerInfo[playerid][pAdmin]
to
Код:
if(pInfo[playerid][Admin])
Код:
pInfo[playerid][Admin]



Re: OnPlayerConnect help - biker122 - 16.05.2014

Looks like you're using Y_INI.
Just go to the logindialog and add this at it's end.
pawn Код:
new name[MAX_PLAYER_NAME], string[128];
if(pInfo[playerid][Admin] == 0)  return 1;
else
{
GetPlayerName(playerid,name,sizeof(name));
format(string, sizeof(string),"Administrator %s has joined the server!",name);
SendClientMessageToAll(-1,string);
}