SA-MP Forums Archive
/robcasino = Restart Why? - 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: /robcasino = Restart Why? (/showthread.php?tid=625798)



/robcasino = Restart Why? - RedRex - 06.01.2017

Hello, When i typing /robcasino at CP Server Restart Why?

Код:
CMD:robcasino(playerid, params[])
{
   if(!IsPlayerInDynamicCP(playerid, CP_robdrag)) return SendClientMessage(playerid, COLOR_RED,"[ERROR]: You must be in checkpoint Four Dragon Casino");
   {
	  if(Dragonrobbedrecently >=1)
	  {
		   SendClientMessage(playerid, COLOR_RED, "[PICKUP] Go Pickup the objects you have 30 Secdons");
	       SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 5);
	       GameTextForPlayer(playerid, "DO NOT LEAVE CHECKPOINT", 500, 1);
	       SetTimer("DragonRobbery", 60000, false);
	       DragonObjects[1] = CreatePickup(1212, 18, 1962.3412,1009.9411,992.4688,-1);
	       DragonObjects[2] = CreatePickup(1212, 18, 1958.0300,1010.0934,992.4688,-1);
	       DragonObjects[3] = CreatePickup(1212, 18, 1958.7378,1015.8269,992.4688,-1);
	       DragonObjects[4] = CreatePickup(1212, 18, 1958.7378,1020.2450,992.4688,-1);
	       DragonObjects[5] = CreatePickup(1212, 18, 1958.0302,1025.4569,992.4688,-1);
	       DragonObjects[6] = CreatePickup(1212, 18, 1962.3405,1025.6857,992.4688,-1);
	       DragonObjects[7] = CreatePickup(1212, 18, 1963.9730,1020.3441,992.4688,-1);
	       DragonObjects[8] = CreatePickup(1212, 18, 1963.9764,1015.7001,992.4688,-1);
	  }
      ROBBING_Dragon[playerid] = 15;
      Dragonrobbedrecently = 200;
      }
   return 1;
}



Re: /robcasino = Restart Why? - iLearner - 06.01.2017

Right after you type or after 60 seconds? and show server_log when it restarts (or crashes).

-Load crashdetect


Re: /robcasino = Restart Why? - xTURBOx - 06.01.2017

Are you using the latest version of streamer(both include and plugin).
Try using crash detect like iLearner said


Re: /robcasino = Restart Why? - RedRex - 06.01.2017

Here you go ...

i added crashdetect
Код:
[13:33:37] [debug] Server crashed while executing Checkpoints.amx
[13:33:37] [debug] AMX backtrace:
[13:33:37] [debug] #0 native SendClientMessageToAll () from sampsvr-port_9883
[13:33:37] [debug] #1 00002e20 in public DragonRobbery () from Checkpoints.amx
[13:33:37] [debug] Native backtrace:
[13:33:37] [debug] #0 dbdde9f0 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[13:33:37] [debug] #1 dbdd7a62 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[13:33:37] [debug] #2 dbdd8764 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[13:33:37] [debug] #3 dbdda6b4 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[13:33:37] [debug] #4 dbdde31d in ?? () from plugins/crashdetect.so
[13:33:37] [debug] #5 dc134410 in __kernel_rt_sigreturn () from linux-gate.so.1
[13:33:37] [debug] #6 dbe4b508 in _IO_vfprintf () from /lib32/libc.so.6
[13:33:37] [debug] #7 dbe6b7a2 in vsprintf () from /lib32/libc.so.6
[13:33:37] [debug] #8 080add67 in ?? () from ./sampsvr-port_9883
[13:33:37] [debug] #9 080d9e51 in ?? () from ./sampsvr-port_9883
[13:33:37] [debug] #10 080950e4 in ?? () from ./sampsvr-port_9883
[13:33:37] [debug] #11 dbdd94d3 in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[13:33:37] [debug] #12 00000000 in nil ()



Re: /robcasino = Restart Why? - iLearner - 06.01.2017

I dont know exactly where, but you've tried to use SendClientMessageToAll without formatting the message, eg:

SendClientMessageToAll(-1, "Player %d Joined Server",playerid);


Re: /robcasino = Restart Why? - RedRex - 06.01.2017

Did you mean this?

Код:
    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);



Re: /robcasino = Restart Why? - Konstantinos - 06.01.2017

Look in timer's callback DragonRobbery. The mistake is what iLearner said: using specifiers directly in client messages without formatting first will result in server crash.


Re: /robcasino = Restart Why? - PhoneixViper - 06.01.2017

Delete The /robcasino and it will not restart


Re: /robcasino = Restart Why? - RedRex - 06.01.2017

Hi Konstantions, Here you go, The Code of DragonRobbery

What's wrong here?
Код:
forward DragonRobbery();
public DragonRobbery()
{
   for(new i=0; i<MAX_PLAYERS; i++)
   {
	   if(IsPlayerConnected(i))
	   {
		  if(ROBBING_Dragon[i] >1)
		  {
			  ROBBING_Dragon[i] --;
			  new time[20];
			  format(time,sizeof(time), "~r~Robbery Time:%d",ROBBING_Dragon[i]);
			  SetPlayerWantedLevel(i, GetPlayerWantedLevel(i) +5);
			  GameTextForPlayer(i,time,500,3);
			  SendClientMessageToAll(COLOR_RED, "[ROBBING]: %s(%d) has robbed Four Dragon Casino Total: %d");
			  CP_DragPoint = CreateDynamicCP(2026.9276,1028.0477,10.8203,2.0, -1, -1, -1, 100.0);

		  }
	   }
   }
   return 1;
}



Re: /robcasino = Restart Why? - Konstantinos - 06.01.2017

Код:
SendClientMessageToAll(COLOR_RED, "[ROBBING]: %s(%d) has robbed Four Dragon Casino Total: %d");
Format first.