SA-MP Forums Archive
Rank for a specific person - 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: Rank for a specific person (/showthread.php?tid=436385)



Rank for a specific person - Excelize - 11.05.2013

Hey

I need to create a system to make a my server say Server Owner Excelize has logged into xxxx
I have a basic script for the same thing but admins:

Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerAdmin(playerid))
{
new name[MAX_PLAYER_NAME];
new string[218];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Admin %s connected!!", name);
SendClientMessageToAll(-1, string);
}
return 1;
}
I need the same thing but to say Server Owner Excelize has logged in in red..

Help please


Re: Rank for a specific person - iggy1 - 11.05.2013

You can't check if a player is admin under OnPlayerConnect. Well you can, but it will ALWAYS return 0.

A player can not be admin as soon as they connect, they must log in first.


Re: Rank for a specific person - Excelize - 11.05.2013

So any suggestions?


Re: Rank for a specific person - _chimera_ - 11.05.2013

Quote:
Originally Posted by Excelize
Посмотреть сообщение
Hey

I need to create a system to make a my server say Server Owner Excelize has logged into xxxx
I have a basic script for the same thing but admins:

Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerAdmin(playerid))
{
new name[MAX_PLAYER_NAME];
new string[218];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Admin %s connected!!", name);
SendClientMessageToAll(-1, string);
}
return 1;
}
I need the same thing but to say Server Owner Excelize has logged in in red..

Help please
it was understood that it was not so instead of:
Код:
IsPlayerAdmin(playerid)
Код:
if(variable[playerid] == 1,2,3,4,5,ecc... return SendClientMessageToAll(-1,"Admin Connected!");
Or

Код:
public OnPlayerConnect(playerid)
{
if(variable[playerid] == 1,2,3,4,5,)
{
new name[MAX_PLAYER_NAME];
new string[218];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Admin %s connected!!", name);
SendClientMessageToAll(-1, string);
}
return 1; or 0 //try it .....
}



Re : Rank for a specific person - Rayan_black - 11.05.2013

Let's say community owner is level 7.
and the admin var is pAdmin[MAX_PLAYERS], if you have an enum or something use enumname[playerid][pAdmin]
pawn Код:
public OnPlayerConnect(playerid)
{
    if(pAdmin[playerid] == 7)
    {
        new string[218];
        format(string, sizeof(string), "Community owner %s joined the server.", GetName(playerid));
        SendClientMessageToAll(-1, string);
    }
    return 1;
}
//add this anywhere in your script
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}



Re: Rank for a specific person - CreativityLacker - 11.05.2013

pawn Код:
public OnPlayerConnect(playerid)
{
    if(strcmp("Excelize", pname(id), false) == 0 && IsPlayerNPC(playerid) == 0)
    {
          SendClientMessageToAll(-1, "Server owner Excelize has joined the server! ");
    }
    return 1;
}
UNLESS you have a SAVING SYSTEM which LOADS whenever a player CONNECTS (mostly saving systems load after the player's LOGIN), then it can be what Rayan said.


Re: Rank for a specific person - Excelize - 11.05.2013

Ok thank you, you guys are great!