SA-MP Forums Archive
Server not running properly on host - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server not running properly on host (/showthread.php?tid=565887)



Server not running properly on host - lean1337 - 01.03.2015

Hi, I have a issue with my server on my host, my afk script is not working there but however when I run my server on my computer it works just fine.

I have updated all my plugins, I use nativechecker, crashdetect. No errors are showing up when starting up the server.

Code: http://pastebin.com/Z1X4qjKb

On my host.
Код:
[00:41:17] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:41:19] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:41:20] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:41:22] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:41:29] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:41:32] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.
When I run server from my computer
Код:
[00:43:10] NOTICE: {FFFFFF}Playerid 1 has been tabbed for 0 minutes/seconds.

[00:43:11] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:01 minutes/seconds.

[00:43:12] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:02 minutes/seconds.

[00:43:13] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:03 minutes/seconds.

[00:43:14] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:04 minutes/seconds.

[00:43:15] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:05 minutes/seconds.

[00:43:17] NOTICE: {FFFFFF}Player 1 has been tabbed for 00:06 minutes/seconds.



Re: Server not running properly on host - arakuta - 01.03.2015

Show us some code, please.


Re: Server not running properly on host - lean1337 - 02.03.2015

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Show us some code, please.
I posted a pastebin! anyways here you go; http://pastebin.com/Z1X4qjKb


Re: Server not running properly on host - hamzajaved780 - 02.03.2015

Use this one

Код:
//On the top of your script
new AFK[MAX_PLAYERS];
new AFKTime[MAX_PLAYERS];
OnPlayerConnect(playerid)
{
   AFKTime[playerid] = SetTimer("AFKCheck",1000,1);
}
forward AFKCheck();
public AFKCheck()
{
  new Float:Pos[3]; // creating an array variable of 3 values whose datatype is Float.
  for(new i = 0; i < MAX_PLAYERS; i++) // Looping through the players.
  {
     GetPlayerPos(i,Pos[0],Pos[1],Pos[2]); // Gets the player position and saves into their variables.
     if(IsPlayerInRangeOfPoint(i,2,Pos[0],Pos[1],Pos[2])) // If player is around the position (if player is at the same place)
     {
        AFK[i]++; // Increment the AFK variable (for every second if player is at same location, increase the AFK variable by 1)
     }
     if(AFK[i] == 60) // If it has been a minute for the player being at the same place
     {
        AFK[i] = 0; // Reset the afk variable
        format(string,sizeof(string),"%s has been auto-kicked for inactivity.",pName(i)); 
	SendClientMessageToAll(COLOR_WHITE,string);
        Kick(playerid); //Kick the player.
      }
  }
  return 1;
}
public OnPlayerUpdate(playerid)
{
   AFK[playerid] = 0;
   return 1;
}
Add the line for your admins though.