Problem
#1

hi... I have made this function.
But it's not working , it completely crashes my server. "When it is used". I'm still not very good with pawno so the code is probably really inefficent and bad. but does anyone know why it crashes? and can you tell me if it would even work ? and maybe even give me a better way of doing it?

Thanks

http://pastebin.com/2mp2jswZ
Reply
#2

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Let me give you a tip for bug finding:

Put a 'print' between on every 10th line where you think the problem is.

like:
pawn Код:
print("1");
somecode();
somecode();
print("2");
somecode();
somecode();
print("3");
If on the console it only prints 1 and 2, you know the problem is somewhere between 2 and 3

So investigate further...


Put a print in between each line of code between these points [you can delete the other prints to avoid confusion]
pawn Код:
print("1");
code...
print("2");
code...
print("3");
-problem code-
print("4");
code...
print("5");
Console will print 1, 2, 3, 4 so you know that the problem is with the code between 4 and 5

Now you can found out exactly what line is causing the problem, then you post on the forum and it helps people help you

Tip: If the console crashes before you can read it, check the "server_log.txt" all prints are saved here.
Thanks , it's definitely when I use it under the teleport command.
so it's
pawn Код:
VehicleLoad(playerid);
and the whole function aswell , is a problem too
Reply
#3

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Use the debug method in the VehicleLoad function, you need to find out what line the problem is on.
I debugged the whole code
so:
Код:
[13:10:22] 1
[13:10:22] 2
[13:10:22] 3
[13:10:22] 4
[13:10:22] 5
[13:10:22] 6
[13:10:22] 7
[13:10:22] 8
[13:10:22] 9
I even did the timer, so I know it's just the function because the timer didn't start.

pawn Код:
forward VehicleLoad(playerid);
public VehicleLoad(playerid)
{

     new Lastveh;
     print("1");
     Lastveh = GetPlayerVehicleID(playerid);
     print("2");
     RemovePlayerFromVehicle(playerid);
     print("3");
     SendClientMessage(playerid,COLOR_YELLOW,"You have been removed from your vehicle to force objects to load.");
     print("4");
     SendClientMessage(playerid,COLOR_YELLOW,"Your be put back in when they have loaded.");
     print("5");
     new Float:X,Float:Y,Float:Z;
     print("6");
     GetPlayerPos(playerid,X,Y,Z);
     print("7");
     SetPlayerPos(playerid,X,Y,Z);
     print("8");
     TogglePlayerControllable(playerid, false);
     print("9");
     SetTimerEx("LoadVehicleEnd", 3000, 1, "Lastveh",Lastveh);
     return 1;

}

Thanks
Reply
#4

I tried some other things and they failed too , so i wont post them.
Anyone know :/?

EDIT: I fixed the crashing with some help.
pawn Код:
SetTimerEx("LoadVehicleEnd", 9000, 1, "s", Lastveh);
But still , the timer isn't working ? Thats my timer function. Lastveh is a variable.
So what is the format for that I tried "s" I tried "d" but none worked.

Anyone thanks ?
Reply
#5

IDK if this will work, but try it: (I have to run for something now, so.. im making it fast...)

pawn Код:
SetTimerEx("LoadVehicleEnd", 5000, 0, "dd", playerid, Lastveh);
Why, because: LoadVehicleEnd(playerid,Lastveh) has 2 parameters.. playerid & lastveh. So, format the timer in that way.

ANd i think its better if you make the timer not to repeat.
Reply
#6

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
IDK if this will work, but try it: (I have to run for something now, so.. im making it fast...)

pawn Код:
SetTimerEx("LoadVehicleEnd", 5000, 0, "dd", playerid, Lastveh);
Why, because: LoadVehicleEnd(playerid,Lastveh) has 2 parameters.. playerid & lastveh. So, format the timer in that way.

ANd i think its better if you make the timer not to repeat.
I'll try it in a bit , kinda busy with something else now. Thanks.

And will post results back!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)