07.07.2009, 13:22
1st you need a part of script that gives you crashes...
Some can be found even at start.. OnGamemodeInit etc.
Others can be OnplayerConnect, or even when player uses simple command.
How to find that crasher bug?
It's simple.
1. Open .pwn of script
2. Find part of script that crashes
3. In part, put
after every line in this part
4. Run the server with edited script, and let it crash.
5. After crash open server_log.txt file
6. Go all way down and find what was the last thing what was logged
7. If you putted numbers and last number is '3' then command or function after
is the thing that crashes
8. Fix the problem if you can
9. Remove
from script
10. Enjoy playing your server!
EXAMPLES:
This makes us bug (not really)
so lets find it, put prints inside!
Hope it's Useful!
P.S. Alligments in code are not as they should be!
(( Topic posted by [GMX]Spirit, not me! ))
Some can be found even at start.. OnGamemodeInit etc.
Others can be OnplayerConnect, or even when player uses simple command.
How to find that crasher bug?
It's simple.
1. Open .pwn of script
2. Find part of script that crashes
3. In part, put
Code:
print("<something to recognise, maybe numbers>");
4. Run the server with edited script, and let it crash.
5. After crash open server_log.txt file
6. Go all way down and find what was the last thing what was logged
7. If you putted numbers and last number is '3' then command or function after
Code:
print("3");
8. Fix the problem if you can
9. Remove
Code:
print("<something to recognise, maybe numbers>");
10. Enjoy playing your server!
EXAMPLES:
Code:
dcmd_l(playerid,params[]) { if(LoggedIn[playerid] == 1) { new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(!strlen(params)) return SendClientMessage(playerid, red, " Correct use: /l [text] - LOCAL"); new str[128]; new string[256]; GetPlayerName(playerid, str, sizeof(str)); format(string,sizeof(string),"> CHAT > LOCAL > %s > %s !",str,params); format(str, sizeof(str), "%s says '%s'", str, params); print(string); ApplyAnimation(playerid,"MISC","Idle_Chat_02",4.1,0,1,1,1,1); for(new i; i<MAX_PLAYERS; i++) { new Float:x,Float:y, Float:z; GetPlayerPos(playerid,x,y,z); if (PlayerToPoint(7,i,x,y,z)) { return SendClientMessage(i,COLOR_WHITE, str); } if (PlayerToPoint(15,i,x,y,z)) { return SendClientMessage(i,COLOR_GRAYDARK, str); } } return 1; } else return SendClientMessage(playerid,red," You must be logged in to use this command"); }
so lets find it, put prints inside!
Code:
dcmd_l(playerid,params[]) { print("1"); if(LoggedIn[playerid] == 1) { new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); print("2"); if(!strlen(params)) return SendClientMessage(playerid, red, " Correct use: /l [text] - LOCAL"); print("3"); new str[128]; new string[256]; GetPlayerName(playerid, str, sizeof(str)); print("4"); format(string,sizeof(string),"> CHAT > LOCAL > %s > %s !",str,params); print("5"); format(str, sizeof(str), "%s says '%s'", str, params); print("6"); print(string); print("7"); ApplyAnimation(playerid,"MISC","Idle_Chat_02",4.1,0,1,1,1,1); for(new i; i<MAX_PLAYERS; i++) print("8"); { new Float:x,Float:y, Float:z; GetPlayerPos(playerid,x,y,z); print("9"); if (PlayerToPoint(7,i,x,y,z)) { print("10"); return SendClientMessage(i,COLOR_WHITE, str); } if (PlayerToPoint(15,i,x,y,z)) { print("11"); return SendClientMessage(i,COLOR_GRAYDARK, str); } } return 1; } print("12"); else return SendClientMessage(playerid,red," You must be logged in to use this command"); }
P.S. Alligments in code are not as they should be!
(( Topic posted by [GMX]Spirit, not me! ))