12.01.2014, 16:12
Just found out that it worked all the time. But. Now I am having a new issue. Before the player logs off, it doesn't actually save his position. How can I make it save before the player actually logs off?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SavePlayer(playerid);
new string[256], astring[256];
switch(reason)
{
case 0: format(string,sizeof string,"%s has lost connection to the server.", RemoveUnderScore(playerid));
case 1: format(string,sizeof string,"%s has left the server.", RemoveUnderScore(playerid));
case 2: format(string,sizeof string,"%s has been kicked or banned from the server.", RemoveUnderScore(playerid));
}
NearByMessage(playerid, GREY, string);
printf("[LOGGING] %s (ID: %d) has just disconnected the server. Reason: %s", pName(playerid), playerid, string);
for(new i = 0; i < MAX_PLAYERS; i++)
if(Player[i][AdminLevel] >= 1)
{
if(!IsPlayerInRangeOfPlayer(i, playerid, 20))
{
switch(reason)
{
case 0: format(astring,sizeof astring,"%s has lost connection to the server.", RemoveUnderScore(playerid));
case 1: format(astring,sizeof astring,"%s has left the server.", RemoveUnderScore(playerid));
case 2: format(astring,sizeof astring,"%s has been kicked or banned from the server.", RemoveUnderScore(playerid));
}
SendAdminMessage(playerid, RED, astring);
}
}
DestroyPlayerTextDraws(playerid);
return 1;
}