Admin has joined the server
#1

Hi guys, well i want to create a filterscript that changes your color once you login to rcon, and also want to use GameTextForAll to show that an admin joined the server. I have the script already (i think), but where i have to put this at a filterscript?

The script i currently have:
Код:
public OnFilterScriptInit()
{

if(IsPlayerAdmin(playerid))
SetPlayerColor(playerid, FFCC00)
new name[ 24 ], string[ 64 ];
GetPlayerName( playerid, name, 24 );
format( string, sizeof(string), "Admin ~w~%s has joined!", name );
GameTextForAll( string, 5000, 3 );

return 1;
}
This doesnt make it working at all in-game. Also my gamemode changes to Blank script when im using this filterscript.
Reply
#2

You can't do it like that, you might want to add this under OnPlayerSpawn, but you will have to /rcon login before spawning.
Reply
#3

https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
Reply
#4

If you have a OnPlayerLogin function (With your register system maybe?) add it there. If you don't know what I mean, check SeifAdmin maybe?
Reply
#5

Quote:
Originally Posted by Burridge
If you have a OnPlayerLogin function (With your register system maybe?) add it there. If you don't know what I mean, check SeifAdmin maybe?
My server does not use a register system. (if you mean /register password).

Maybe ill try the OnPlayerSpawn one.

Another problem when i add it to my gamemode, i am getting about 3 errors.
Код:
C:\Users\Fred\Documents\samp03asvr_win32\gamemodes\grandlarc.pwn(142) : error 010: invalid function or declaration
C:\Users\Fred\Documents\samp03asvr_win32\gamemodes\grandlarc.pwn(145) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Fred\Documents\samp03asvr_win32\gamemodes\grandlarc.pwn(148) : error 010: invalid function or declaration
Line 142:
Код:
if(IsPlayerAdmin(playerid))
Line 145:
Код:
GetPlayerName(playerid, name, 24);
Line 148:
Код:
return 1;
Sorry, but i have just started with pawno scripting so i need to get a bit more experience with this.
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerColor(playerid, 0xFFCC00AA);
        new name[ 24 ], string[ 64 ];
        GetPlayerName( playerid, name, 24 );
        format( string, sizeof(string), "~r~Admin ~w~%s ~r~has joined!", name );
        GameTextForAll( string, 5000, 3 );
        return 1;
    }
}
Reply
#7

If you want to do it ZeeX's way then here you go:

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(success)
  {
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true))
            {
                SetPlayerColor(i, 0xFFCC00AA);
                new name[24], string[64];
                GetPlayerName(i, name, 24);
                format(string, sizeof(string), "~r~Admin ~w~%s ~r~is in game!", name);
                GameTextForAll(string, 5000, 3);
                return 1;
            }
        }
  }
  return 1;
}
Reply
#8

Thank you, again something that i have learned with this scripting.
Reply
#9

I know you've already solved it, but look at this, might help others in future references!

https://sampwiki.blast.hk/wiki/IsPlayerAdmin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)