29.05.2011, 12:48
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:
And put this in OnPlayerDisconnect:
.. or click here for what they should look like.
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 );
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);
}
}