Jump to content
  • 0

Problema restart server


Andrey003

Question

Problemă întâlnită (descriere): Can dau /restart la server scrie restart in 2 minute ,iar dupa ce isi da restart incep niste textdraw sa dispara si sa apara cu o locatie "Blueberry ..."
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul:
[pawn]
COMMAND:restart(playerid, params[])
{
// Send the command to all admins so they can see it
SendAdminText(playerid, "/restart", params);

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 7
if (APlayerData[playerid][PlayerLevel] >= 7)
{

// Let everyone know that the server will be restarted in 2 minutes
GameTextForAll("Restart server in 2 minute!", 5000, 3);
SendClientMessageToAll(0xA0A0A0, "Restart server in 2-a minute!");
// Start the next timer which warns the players again that server will be restarted in 1 minute
SetTimer("Timer_Restart_WarnPlayers", 1000 * 60, false);
}
else
   return 0;
}
else
   return 0;

// Let the server know that this was a valid command
return 1;
}

forward Timer_Restart_WarnPlayers();
public Timer_Restart_WarnPlayers()
{
// Let everyone know that the server will be restarted in 1 minutes

GameTextForAll("Restart server intr-un minut!", 5000, 3);

SendClientMessageToAll(0xA0A0A0, "Restart server intr-un minut!");

// Start the next timer

SetTimer("Timer_Restart_Kick", 1000 * 60, false);

// Change the hostname of the server and it's password

SendRconCommand("hostname Pending Restart");


return 1;

}

forward Timer_Restart_Kick();

public Timer_Restart_Kick()
{

// Let everyone know that the server is kicking all players before restarting

GameTextForAll("Server restarting:Reconect!", 5000, 3);

// Kick all players

for(new i; i < MAX_PLAYERS; i++)
Kick(i);

// Start the next timer that will restart the server

SetTimer("Timer_Restart_Reboot", 1000 * 5, false);
return 1;
}

forward Timer_Restart_Reboot();
public Timer_Restart_Reboot()
{
// Restart the server
SendRconCommand("gmx");
return 1;
}
[/pawn]

Imagini / Video (optional):
http://imgur.com/Wx1JUHf,f2MsZJq,EG48X8Z#0 - cand dau restart
http://imgur.com/Wx1JUHf,f2MsZJq,EG48X8Z#2 -dupa ce dau restart acele texte de sus , jos ,si alea din dreapta tot dispar si apar
Aţi încercat să rezolvaţi singur?: nu stiu cum

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

Te rog da-mi OnPlayerConnect si OnGameModeInit. Dar pune un link de pe pastebin, sunt mari sau daca vrei sa le pui cu tag-urile [ pawn ][/ pawn ] pentru ca nu pastreaza indent nu da pe iconita de la editor, pune tu manual tag-urile. (e un bug pe care l-am raportat, dar se repara in versiunea 4.0)

Link to comment
Share on other sites

[pawn]public OnGameModeInit()
{
new HostCommand[128];
// Change the hostname
format(HostCommand, 128, "hostname %s", GameModeName);
SendRconCommand(HostCommand);
 
GameModeInit_VehiclesPickups(); // Add all static vehicles and pickups when the server starts that are required (also load the houses)
GameModeInit_Classes(); // Add character models to the class-selection (without weapons)
 
Convoys_Init(); // Setup textdraws and default data for convoys
 
ShowPlayerMarkers(1); // Show players on the entire map (and on the radar)
ShowNameTags(1); // Show player names (and health) above their head
ManualVehicleEngineAndLights(); // Let the server control the vehicle's engine and lights
EnableStuntBonusForAll(0); // Disable stunt bonus for all players
DisableInteriorEnterExits(); // Removes all building-entrances in the game
UsePlayerPedAnims(); // Use CJ's walking animation
 
// Start the timer that will show timed messages every 2 minutes
SetTimer("Timer_TimedMessages", 1000 * 60 * 2, true);
// Start the timer that will show a random bonus mission for truckers every 5 minutes
SetTimer("ShowRandomBonusMission", 1000 * 60 * 5, true);
// Start the timer that checks the toll-gates
SetTimer("Toll", 1000, true);
 
// Fix the bugged houses (after fixing the houses, you can remove this line, as it's not needed anymore)
FixHouses();
 
// While the gamemode starts, start the global timer, and run it every second
SetTimer("GlobalTimer", 1000, true);
return 1;
}[/pawn]
 
[pawn]// Always allow NPC's to login without password or account
 
if (IsPlayerNPC(playerid))
  return 1;
 
// Setup local variables
new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;
 
// Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
SetPVarInt(playerid, "PVarMoney", 0);
SetPVarInt(playerid, "PVarScore", 0);
 
// Get the playername
GetPlayerName(playerid, Name, sizeof(Name));
// Also store this name for the player
GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
 
// Send a message to all players to let them know somebody else joined the server
format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);
 
// Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
if (PlayerFile_Load(playerid) == 1)
{
// Check if the player is still banned
if (APlayerData[playerid][banTime] < gettime()) // Player ban-time is passed
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
else // Player is still banned
{
ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
Kick(playerid); // Kick the player
}
}
else
ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);
 
// The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
{
   // Get the HouseID from this slot
   HouseID = APlayerData[playerid][Houses][HouseSlot];
   // Check if there is a house in this slot
if (HouseID != 0)
   HouseFile_Load(HouseID, true); // Load the cars of the house
}
 
 // Speedometer setup
Speedometer_Setup(playerid);
 
// MissionText TextDraw setup
APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.0, " "); // Setup the missiontext at the bottom of the screen
TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext
TextDrawFont(APlayerData[playerid][MissionText], 1);//set stilu de scris text
 
// Display a message if the player hasn't accepted the rules yet
if (APlayerData[playerid][RulesRead] == false)
  SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Nu Ai Acceptat {FFFF00}/rules{FF0000}");

// 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);
}
[/pawn]
 
am scos de la onplayerconect niste RemoveBuildingForPlayer dar nu cred ca are vreo treaba

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.