2 questions
#9

Honestly, I've never really used PVars, but I gave it a go. I tested this script and it should work:

Put this in OnPlayerConnect:

pawn Код:
new szIP[ 16 ];

//Get the players IP and assign it to szIP
GetPlayerIp( playerid, szIP, sizeof szIP );
   
//Set the PVar to the value of szIP for later use.
SetPVarString( playerid, "p_szIP", szIP );
And put this in OnPlayerDisconnect:

pawn Код:
new szStr [ 128 ],
    szIP  [ 16  ];

//Get the PVar and assign the value to the local variable, szIP.
GetPVarString( playerid, "p_szIP", szIP, sizeof szIP );

for (new i = 0; i < MAX_PLAYERS; i++)
{
    //Loop de loop
    if( IsPlayerAdmin(i) )
    {
        //They're an admin

        switch( reason )
        {
            //Timeout
            case 0:
                format(szStr, sizeof(szStr), "%s. IP: %s. has left the server (Timed out)", PlayerName(playerid), szIP);
       
            //Quit
            case 1:
                format(szStr, sizeof(szStr), "%s. IP: %s. has left the server (Quit)", PlayerName(playerid), szIP);
       
            //Kicked
            case 2:
                format(szStr, sizeof(szStr), "%s. IP: %s. has left the server (Kicked)", PlayerName(playerid), szIP);
        }

        //Send the message
        SendClientMessage(i, Grey, szStr);
    }
}
.. or click here for what they should look like.
Reply


Messages In This Thread
2 questions - by fissekarl - 28.05.2011, 15:58
Re: 2 questions - by Ash. - 28.05.2011, 16:16
Re: 2 questions - by fissekarl - 28.05.2011, 16:28
Re: 2 questions - by Osviux - 28.05.2011, 16:33
Re: 2 questions - by fissekarl - 28.05.2011, 19:38
Re: 2 questions - by Fj0rtizFredde - 28.05.2011, 19:43
Re: 2 questions - by fissekarl - 28.05.2011, 19:54
Re: 2 questions - by fissekarl - 29.05.2011, 11:15
Re: 2 questions - by blewert - 29.05.2011, 12:48
Re: 2 questions - by fissekarl - 29.05.2011, 13:22

Forum Jump:


Users browsing this thread: 1 Guest(s)