PDA

View Full Version : help +rep


Xtreme Brotherz
15/05/2012, 05:36 AM
how can i know whether there are no players in the server

i want to restart the server when players are not there only once..how to do it??

Roperr
15/05/2012, 05:38 AM
What do you mean?

You can open up SA:MP, add your server IP to favorites and check it ...

TzAkS.
15/05/2012, 05:39 AM
If i understant what are you saying..you can look on sa-mp client and see if is any player on the server or if you hosted your server you can see there in control panel.

Xtreme Brotherz
15/05/2012, 05:41 AM
no i mean i should see the no. of players by typing a command ingame

TzAkS.
15/05/2012, 05:41 AM
You can see how many players is with TAB

Xtreme Brotherz
15/05/2012, 05:43 AM
not for just seeing.. i want to auto restart the server when no players are there

FarSe.
15/05/2012, 05:44 AM
//OnGameModeInit
SetTimer("CheckForPlayers",5*60*1000,1);//5 minutes


//
forward CheckForPlayers();
public CheckForPlayers()
{
for(new i;i<MAX_PLAYERS;i++)if(IsPlayerConnected(i)&&!IsPlayerNPC(i))return 1;
SendRconCommand("gmx");
return 1;
}

Xtreme Brotherz
15/05/2012, 05:45 AM
thnxx +rep for all the three

Roperr
15/05/2012, 05:50 AM
//OnGameModeInit
SetTimer("CheckForPlayers",5*60*1000,1);//5 minutes


//
forward CheckForPlayers();
public CheckForPlayers()
{
for(new i;i<MAX_PLAYERS;i++)if(IsPlayerConnected(i)&&!IsPlayerNPC(i))return 1;
SendRconCommand("gmx");
return 1;
}

Why would you restart the server every 5 minutes (if it's empty of course)?

I see no use of this, sorry.

Xtreme Brotherz
15/05/2012, 05:54 AM
i'm using luxadmin and my script has a problem. if any player registers it wont save the player file but creates one empty file
and i tried adding manything for saving but coudn't. restarting is the only way to save it.

anyway thnxxfor help

Roperr
15/05/2012, 05:56 AM
There should be a timer for saving player stats somewhere in the code...

This is a bad solution to a problem like that, ask inside the luxadmin topic, they might be able to help you.

linuxthefish
15/05/2012, 06:08 AM
Very bad solution, LuxAdmin is outdated.

Xtreme Brotherz
15/05/2012, 06:10 AM
thnxx i had found the way out!!

JaKe Elite
15/05/2012, 06:10 AM
instead of editing other admin script how about script it yourself?
i'm start scripting my own admin system. i made 20+ admin commands once a day

Xtreme Brotherz
15/05/2012, 06:12 AM
currently i doesnt have enough time to do scripting along with my studies