Checkpoint help.
#2

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Debug your code by putting print lines in the code so you can interactively see what the code is doing.

For instance:

pawn Код:
else if(IsMilkingCows[playerid] > 0)//farmerjob
    {
        print("Milking cows > 0");
        if(IsMilkingCows[playerid] == 1)
        {
            print("\tMilking cows == 1");
            MilkTime[playerid] += 1;
            TogglePlayerControllable(playerid, 0);
            DisablePlayerCheckpoint(playerid);
            print("\tDisabled checkpoint, setting new one");
            SetPlayerCheckpoint(playerid, -415.4362,-1367.9500,23.7354,1.0);
            IsMilkingCows[playerid] = 2;
            print("\t- End of code block");
        }
        else if(IsMilkingCows[playerid] == 2)
        {
            print("\tMilking cows == 2");
            MilkTime[playerid] += 1;
// etc...
This way you can see if, for instance maybe the "IsMilkingCows[playerid]" isn't passing the checks due to a possible OOB error, either here or in another part of your script which is causing (what I believe is called) memory leak (where you try to assign values out of bounds and it ends up being put in another variable somewhere else)
when i tried what you said it still doesnt show another checkpoint but however this is what it shows on the console;

PHP код:
MilkingCows 0
Milking Cows 
== 1
Disabled checkpoint
setting new one
-End of code block 
thats what i editted;

PHP код:
else if(IsMilkingCows[playerid] > 0)//farmerjob
    
{
        print(
"Milking cows > 0");
        if(
IsMilkingCows[playerid] == 1)
        {
            print(
"\tMilking cows == 1");
            
MilkTime[playerid] += 1;
            
TogglePlayerControllable(playerid0);
            
DisablePlayerCheckpoint(playerid);
            print(
"\tDisabled checkpoint, setting new one");
            
SetPlayerCheckpoint(playerid, -415.4362,-1367.9500,23.7354,1.0);
            
IsMilkingCows[playerid] = 2;
            print(
"\t- End of code block");
        }
        else if(
IsMilkingCows[playerid] == 2)
        {
            
MilkTime[playerid] += 1;
            print(
"\tMilking cows == 2"); 
Reply


Messages In This Thread
Checkpoint help. - by HarryPotter - 06.12.2012, 20:59
Re: Checkpoint help. - by HarryPotter - 07.12.2012, 12:11
Re: Checkpoint help. - by HarryPotter - 12.12.2012, 17:58
Re: Checkpoint help. - by HarryPotter - 15.12.2012, 19:59

Forum Jump:


Users browsing this thread: 1 Guest(s)