OnPlayerEnterRaceCheckpoint
#1

I've got a really strange problem...That i really don't get.I have 12 checkpoints, but when i go through checkpoint 11 i must enter it TWICE so the next one will show, now when i enter the last one, i stay blocked and it's like i go through all checkpoints, it does everything checkpoint 1-11 has over and over without exacpe....strange?Any ideas?
Here is my code...
pawn Code:
new Float:TCP[12][3] =
{
    {1921.92065400,-1792.39563000,12.44057200},
    {1790.08483900,-1692.28881800,12.40553200},
    {1951.09899900,-1565.78064000,12.54073800},
    {2031.99963400,-1287.80712900,20.03146700},
    {2457.61377000,-1782.79614300,12.47963600},
    {2429.854492, -1020.221069, 53.432087},
    {2454.919434, -1050.255127, 58.984962},
    {2485.740723, -1022.415833, 64.622757},
    {2527.915283, -1038.075684, 68.872475},
    {2039.614624, 1891.419922, 10.908257},
    {1725.56250000, 923.91259800, 9.75307400},
    {1681.5713,2312.2737,10.7798}
};
pawn Code:
public OnPlayerEnterRaceCheckpoint(playerid)
{

    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 408)
    {

    if(TrashP[playerid] < 11 && TrashOnOff[playerid] == 1)//normal checks...
    {
        TrashP[playerid]++;
        new Float:vx,Float:vy,Float:vz,Float:X,Float:Y,Float:Z;
        TogglePlayerControllable(playerid, 0);
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 0.2, vy * 0.2, vz * 0.2);
        SetTimerEx("TrashUnFreeze",2000,0,"i",playerid);
        GetPlayerPos(playerid, X,Y,Z);
        PlayerPlaySound(playerid, 1149, X, Y, Z);
        GivePlayerMoney(playerid, 100);
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~+~g~$100~w~", 1000, 3);
      SetPlayerRaceCheckpoint(playerid, 0, TCP[TrashP[playerid]][0], TCP[TrashP[playerid]][1], TCP[TrashP[playerid]][2], TCP[TrashP[playerid]+1][0], TCP[TrashP[playerid]+1][1], TCP[TrashP[playerid]+1][2], 3);
    }
    else if(TrashP[playerid] == 11 && TrashOnOff[playerid] == 1)//to show theLast checkpoint
  {
        TrashOver[playerid] = SetTimerEx("DepositTheTrash",1896,1,"i",playerid);
        TrashP[playerid]++;
        TrashUp2[playerid] = 0;
        TogglePlayerControllable(playerid, 0);
        GameTextForPlayer(playerid, "~w~Depositing the ~g~trash~w~....",1337+1337+1337,3);
        SetPlayerRaceCheckpoint(playerid, 1, TCP[TrashP[playerid]][0], TCP[TrashP[playerid]][1], TCP[TrashP[playerid]][2], TCP[TrashP[playerid]][0], TCP[TrashP[playerid]][1], TCP[TrashP[playerid]][2], 4.0);
    }
    else if(TrashP[playerid] == 12 && TrashOnOff[playerid] == 1)//Last checkpoint
  {
        TrashOver[playerid] = SetTimerEx("EndTrashMission",1337,0,"i",playerid);
        new Min,Sec,MS;
        TimeCount[playerid]=GetTickCount()-TimeCount[playerid];
    ConvertTime(TimeCount[playerid],Min,Sec,MS);
        TrashUp2[playerid] = 0;
        TogglePlayerControllable(playerid, 0);
        DisablePlayerRaceCheckpoint(playerid);
        format(string,sizeof(string),"Mission finished in: %02d:%02d.%01d",Min,Sec,MS/100);
        SendClientMessage(playerid,COLOR_FAIL, string); print(string);
       
    }
    if(TrashP[playerid] == 1 && TrashOnOff[playerid] == 1)
    {
         //Code

    }

    if(TrashP[playerid] == 2 && TrashOnOff[playerid] == 1)
    {
       //Code

    }

    if(TrashP[playerid] == 3 && TrashOnOff[playerid] == 1)
    {
     //Code
    }

    if(TrashP[playerid] == 4 && TrashOnOff[playerid] == 1)
    {
    //Code
    }

     if(TrashP[playerid] == 5 && TrashOnOff[playerid] == 1)
    {
     //Code
    }
    if(TrashP[playerid] == 6 && TrashOnOff[playerid] == 1)
    {
    //Code
    }
    if(TrashP[playerid] == 7 && TrashOnOff[playerid] == 1)
    {
         //Code
    }
    if(TrashP[playerid] == 8 && TrashOnOff[playerid] == 1)
    {
         //Code
    }
    if(TrashP[playerid] == 9 && TrashOnOff[playerid] == 1)
    {
      //Code
    }
    if(TrashP[playerid] == 10 && TrashOnOff[playerid] == 1)
    {
         //Code
    }
    }

    return 1;
}
I saw this on a mission script same things i've done, doesn't work...everything gets fucked up at the finish...
Help would be greatly appreciated and you will be in credits when i will release this
Reply
#2

pawn Code:
if(TrashP[playerid] < 11 && TrashOnOff[playerid] == 1)//normal checks...
    {
        TrashP[playerid]++;
        new Float:vx,Float:vy,Float:vz,Float:X,Float:Y,Float:Z;
        TogglePlayerControllable(playerid, 0);
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 0.2, vy * 0.2, vz * 0.2);
        SetTimerEx("TrashUnFreeze",2000,0,"i",playerid);
        GetPlayerPos(playerid, X,Y,Z);
        PlayerPlaySound(playerid, 1149, X, Y, Z);
        GivePlayerMoney(playerid, 100);
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~+~g~$100~w~", 1000, 3);
      SetPlayerRaceCheckpoint(playerid, 0, TCP[TrashP[playerid]][0], TCP[TrashP[playerid]][1], TCP[TrashP[playerid]][2], TCP[TrashP[playerid]+1][0], TCP[TrashP[playerid]+1][1], TCP[TrashP[playerid]+1][2], 3);
    }
    /*else*/ if(TrashP[playerid] == 11 && TrashOnOff[playerid] == 1)//to show theLast checkpoint  <----------- loose the else and it should complete the first time
  {
        TrashOver[playerid] = SetTimerEx("DepositTheTrash",1896,1,"i",playerid);
Reply
#3

Quote:
Originally Posted by (SF)Noobanatior
pawn Code:
if(TrashP[playerid] < 11 && TrashOnOff[playerid] == 1)//normal checks...
    {
        TrashP[playerid]++;
        new Float:vx,Float:vy,Float:vz,Float:X,Float:Y,Float:Z;
        TogglePlayerControllable(playerid, 0);
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
        SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 0.2, vy * 0.2, vz * 0.2);
        SetTimerEx("TrashUnFreeze",2000,0,"i",playerid);
        GetPlayerPos(playerid, X,Y,Z);
        PlayerPlaySound(playerid, 1149, X, Y, Z);
        GivePlayerMoney(playerid, 100);
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~+~g~$100~w~", 1000, 3);
      SetPlayerRaceCheckpoint(playerid, 0, TCP[TrashP[playerid]][0], TCP[TrashP[playerid]][1], TCP[TrashP[playerid]][2], TCP[TrashP[playerid]+1][0], TCP[TrashP[playerid]+1][1], TCP[TrashP[playerid]+1][2], 3);
    }
    /*else*/ if(TrashP[playerid] == 11 && TrashOnOff[playerid] == 1)//to show theLast checkpoint  <----------- loose the else and it should complete the first time
  {
        TrashOver[playerid] = SetTimerEx("DepositTheTrash",1896,1,"i",playerid);
It's same thing....nothing has changed....i hate this bug, it's been on my head for 2 days straight....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)