SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/05/2019, 08:21 AM   #1
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Help Server crashing

My Server is crashing when i do /robbery help me please?

PHP Code:
SA-MP Server0.3.7-R2



Exception At Address
0x00402318 Module: (samp-server.exe)



Registers:

EAX0x00000062    EBX0x00000001    ECX0x001E5250    EDX0x000EE9F0

ESI
0x03C0F424    EDI0x01E8A750    EBP0x03BF115C    ESP0x0018F3DC

EFLAGS
0x00010206



Stack
:

+
00000x0018F87C   0x00000001   0x03D01D4C   0x01E8A750

+00100x00000001   0x000F2914   0x001E5250   0x000F291C

+00200x000EE9F8   0x000EE9F0   0x000EE9F8   0x03BF1144

+00300x03C0F424   0x00000000   0x03BF0020   0x0001E2E0

+00400x004746BE   0x01E8A750   0x0018F86C   0x00000033

+00500x00470001   0x00007369   0x5F646D63   0x62626F72

+00600x00797265   0x01E8A750   0x03C0F424   0x00000000

+00700x000EE9F0   0x00000000   0x00000000   0x00000000

+00800x00000000   0x00000000   0x00000000   0x00000000

+00900x00000000   0x00000000   0x00000000   0x00000000

+00A00x00000000   0x00000000   0x00000000   0x00000000

+00B00x01DF0358   0x003688B0   0x00000008   0x01DF015C

+00C00x00000000   0x003688B0   0x01DF0048   0x01DF015C

+00D00x0000000A   0x029DAF00   0x00360000   0x029DAF70

+00E00x01E2EF88   0x0018F570   0x770D71D5   0x00000000

+00F00x00000004   0x0018F5BC   0x0000000A   0x00360000

+01000x029DAF00   0x0018F5BC   0x77093C94   0x77093CC3

+01100x774899ED   0x0018F730   0x003601D4   0x00360000

+01200x00360150   0x0001EB90   0x0001ABC0   0x00360150

+01300x0001ABC0   0x00360174   0x029E4704   0x00000004 
Thanks for helping
XoMoX is offline   Reply With Quote
Old 23/05/2019, 10:44 AM   #2
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 116
Reputation: 6
Default Re: Help Server crashing

And what about showing the code?
Koreadars is offline   Reply With Quote
Old 23/05/2019, 12:42 PM   #3
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Re: Help Server crashing

its a long one
XoMoX is offline   Reply With Quote
Old 23/05/2019, 12:54 PM   #4
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 136
Reputation: 8
Default Re: Help Server crashing

Show the robbery command. These crash reports are basically meaningless and nobody can help based by them.
Most crashes when the server is already running happen when you try to access an index of an array which doesn't exists.
Plastikmensch is offline   Reply With Quote
Old 23/05/2019, 02:43 PM   #5
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Re: Help Server crashing

Here is the robbery command

Quote:
CMD:robbery(playerid, params[])
{
new skinid = GetPlayerSkin(playerid);
if(skinid != 300 || skinid != 301 || skinid != 302 || skinid != 303 || skinid != 305 || skinid != 306 || skinid != 307 || skinid != 308 || skinid != 309 || skinid != 310 || skinid != 311)
{
if(IsPlayerInRangeOfPoint(playerid,-2162.2000000,646.7999900,1057.0000000))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(IsPlayerInRangeOfPoint(playerid,-2651.8999000,1428.2000000,911.9000200))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(IsPlayerInRangeOfPoint(playerid,1141.5000000,12 .2000000,1000.1000000))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(IsPlayerInRangeOfPoint(playerid,-2123.3000000,-280.1000100,34.8000000))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(IsPlayerInRangeOfPoint(playerid,-1951.7000000,638.7999900,46.0000000))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(IsPlayerInRangeOfPoint(playerid,-1376.2000000,1494.1000000,10.7000000))
{
SetTimerEx("Robbery", 10000, 0, "i", playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
}
if(skinid == 300 || skinid == 301 || skinid == 302 || skinid == 303 || skinid == 305 || skinid == 306 || skinid == 307 || skinid == 308 || skinid == 309 || skinid == 310 || skinid == 311)
{
SendClientMessage(playerid, 0xAA3333AA, "Officers cant rob");
}
return 1;
}
XoMoX is offline   Reply With Quote
Old 23/05/2019, 03:08 PM   #6
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Re: Help Server crashing

Here is the Robbery command

PHP Code:
CMD:robbery(playeridparams[])
{
new 
skinid GetPlayerSkin(playerid);
if(
skinid != 300 || skinid != 301 || skinid != 302 || skinid != 303 || skinid != 305 || skinid != 306 || skinid != 307 || skinid != 308 || skinid != 309 || skinid != 310 || skinid != 311)
{
if(
IsPlayerInRangeOfPoint(playerid,-2162.2000000,646.7999900,1057.0000000))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(
IsPlayerInRangeOfPoint(playerid,-2651.8999000,1428.2000000,911.9000200))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(
IsPlayerInRangeOfPoint(playerid,1141.5000000,12.2000000,1000.1000000))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(
IsPlayerInRangeOfPoint(playerid,-2123.3000000,-280.1000100,34.8000000))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(
IsPlayerInRangeOfPoint(playerid,-1951.7000000,638.7999900,46.0000000))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
else if(
IsPlayerInRangeOfPoint(playerid,-1376.2000000,1494.1000000,10.7000000))
{
SetTimerEx("Robbery"100000"i"playerid);
SendClientMessage(playerid,-1,"Robbing");
GameTextForPlayer(playerid,"Robbing the safe...",10000,6);
}
}
if(
skinid == 300 || skinid == 301 || skinid == 302 || skinid == 303 || skinid == 305 || skinid == 306 || skinid == 307 || skinid == 308 || skinid == 309 || skinid == 310 || skinid == 311)
{
SendClientMessage(playerid0xAA3333AA"Officers cant rob");
}
return 
1;

XoMoX is offline   Reply With Quote
Old 23/05/2019, 04:42 PM   #7
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 136
Reputation: 8
Default Re: Help Server crashing

Hmh, I see really bad practice but nothing that would crash the server. What is inside the Robbery function?
Some tips:
You don't need to check if a player has a specific skin and then check if a player has not that skin.
Code:
If(skinid==300 || ...)
else
is sufficient. Also a switch-case is probably better for this
Code:
switch(GetPlayerSkin(playerid))
{
   case 300 .. 311:
   {
      //SendMessage
   }
   default:
   {
      //StartRobbery
   }
}
There is a lot of repetition. Create an array and store the coordinates in it.
Code:
new Float:robberyLocations[][3] = {
   {<x>,<y>,<z>},
   ...
};
Then you can do:
Code:
for(new i=0,j=sizeof(robberyLocations);i<j;i++)
{
   if(IsPlayerInRangeOfPoint(playerid,10.0,robberyLocations[i][0],robberyLocations[i][1],...)
   {
      //DoStuff
   }
}
And you can delete params[] in the command since you don't use any.
Code:
CMD:robbery(playerid)

Last edited by Plastikmensch; 23/05/2019 at 11:52 PM. Reason: fixed mistake
Plastikmensch is offline   Reply With Quote
Old 23/05/2019, 06:39 PM   #8
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Re: Help Server crashing

Well the crash started when i created the jail system and to my gamemode i have 61 warnings is the warning is the reason that my server is crashing
XoMoX is offline   Reply With Quote
Old 23/05/2019, 11:49 PM   #9
Plastikmensch
Big Clucker
 
Join Date: Aug 2016
Posts: 136
Reputation: 8
Default Re: Help Server crashing

Could be, but depends on the warnings.

Missed that completely, you didn't set a range.
https://wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint
Plastikmensch is offline   Reply With Quote
Old 24/05/2019, 06:12 AM   #10
XoMoX
Little Clucker
 
Join Date: Nov 2018
Posts: 23
Reputation: 0
Default Re: Help Server crashing

Ohhh right i missed that too xD
XoMoX is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Crashing After Upgrading To Windows Server 2016 NinjaChicken Server Support 4 04/07/2018 02:35 PM
server crashing suni Server Support 1 09/08/2015 05:58 PM
Server Crashing every hour, please help[Provided Server Log with crashdetect] Guest4390857394857 Server Support 5 09/06/2014 10:46 AM
Server crashing TheSimpleGuy Scripting Help 2 04/05/2014 03:14 PM
Server Crashing AryanV Server Support 4 13/11/2013 01:31 AM


All times are GMT. The time now is 08:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.