10.03.2010, 21:07
Stop repeatably posting..
Err, ok. Let me explain while using examples..
That will crash your server, but you don't know why it's not ( lets just pretend ). So you view the code command or whatever when it's crashing and comment the lines and see if the server still crashes.
So, lets test this:
You commented the first print, this will disable the function from running, but oh no, you server still crashes, so go back to the code and uncomment the function we did comment so it will be back to this:
Now lets comment fopen, it should look like this:
It solved the server crashing problem! So you now know: fopen("file.txt", io_read); was crashing your server and most likely you will debug that code and break it down or remove it.
Another way of testing it is that you can make print lines before every function.
Like this for an example:
You can debug it by doing using this as a example:
If your server crashes after that, then put it after the next function which is GameTextForPlayer.
It's still crashing and the print shows, so then try the next function and so on until you find the crashing functions.
This is the best I can explain the "debug code" method.
Quote:
Originally Posted by Silox
omg, i don't know what you mean
![]() |
Код:
print("Test"); fopen("file.txt", io_read); print("Test");
So, lets test this:
Код:
//print("Test"); fopen("file.txt", io_read); print("Test");
Код:
print("Test"); fopen("file.txt", io_read); print("Test");
Код:
print("Test"); //fopen("file.txt", io_read); print("Test");
Another way of testing it is that you can make print lines before every function.
Like this for an example:
Код:
public OnPlayerConnect(playerid) { GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5); fopen("file.txt", io_read); return 1; }
Код:
public OnPlayerConnect(playerid) { print("This works"); GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5); fopen("file.txt", io_read); return 1; }
Код:
public OnPlayerConnect(playerid) { GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5); print("This works"); fopen("file.txt", io_read); return 1; }
This is the best I can explain the "debug code" method.