02.01.2012, 08:25
like this?
Код:
// Display a message if the player hasn't accepted the rules yet if(APlayerData[playerid][RulesRead] == false) { SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't accepted the {FFFF00}/rules{FF0000} yet"); } return 1; } // This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds) ShowRemainingBanTime(playerid) { // Setup local variables new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128]; // Get the total ban-time TotalBanTime = APlayerData[playerid][BanTime] - gettime(); // Calculate days if (TotalBanTime >= 86400) { Days = TotalBanTime / 86400; TotalBanTime = TotalBanTime - (Days * 86400); } // Calculate hours if (TotalBanTime >= 3600) { Hours = TotalBanTime / 3600; TotalBanTime = TotalBanTime - (Hours * 3600); } // Calculate minutes if (TotalBanTime >= 60) { Minutes = TotalBanTime / 60; TotalBanTime = TotalBanTime - (Minutes * 60); } // Calculate seconds Seconds = TotalBanTime; // Display the remaining ban-time for this player SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned); format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds); SendClientMessage(playerid, 0xFFFFFFFF, Msg); } // This callback gets called when a player disconnects from the server public OnPlayerDisconnect(playerid, reason) { // Always allow NPC's to logout without password or account if (IsPlayerNPC(playerid)) return 1;