RPickup.Remove();

Started by Nihongo^, Apr 12, 2023, 07:30 AM

Previous topic - Next topic

Nihongo^

Hi i am getting this error when the race get canceled when no one join it



here's the line 64



function closerace() {
    Message( "Race cancelled!" );
    race = false;
 racestart = false;
    racecount = 0;

 Vehicle1.Remove();
 Vehicle2.Remove();
 Vehicle3.Remove();
 Vehicle4.Remove();

 Checkpoint0.Remove();
 Checkpoint1.Remove();
 Checkpoint2.Remove();
 Checkpoint3.Remove();
 Checkpoint4.Remove();
 Checkpoint5.Remove();
 Checkpoint6.Remove();
 Checkpoint7.Remove();
 Checkpoint8.Remove();
 Checkpoint9.Remove();
 Checkpoint10.Remove();

 RPickup.Remove();
 
 for( local i=0; i<1000; i++ ){
 DestroyMarker( i );
 }
 
    local plr;
    for( local i=0; i <= GetMaxPlayers(); i++ ){
  {
      plr = FindPlayer( i );
      if ( plr )
            {
    if( Stats[ plr.ID ].raceplayer )
    {
                    Stats[ plr.ID ].raceplayer = false;
                    plr.IsFrozen = false;
                    plr.Pos = Vector( 496.26, -83.9443, 10.0302  );
    }
            }
        }
 }

}


P.S Also i tried Pickup.Remove(); but giving the same error

Gito Baloch

Quote from: Nihongo^ on Apr 12, 2023, 07:30 AMP.S Also i tried Pickup.Remove(); but giving the same error

What error does it show when you remove Pickup.remove()?
Programming is the language I speak, the world I shape, and the future I code

Nihongo^

Quote from: Gito Baloch on Apr 12, 2023, 12:27 PM
Quote from: Nihongo^ on Apr 12, 2023, 07:30 AMP.S Also i tried Pickup.Remove(); but giving the same error

What error does it show when you remove Pickup.remove()?
Pickup does not exist

habi

#3
There is some problem in the racing module you are using. I think it is: once a race is cancelled or something, another player cannot start it or so. not remember exactly what it was.
@Sebastian

Nihongo^

Quote from: habi on Apr 12, 2023, 03:37 PMThere is some problem in the racing module you are using. I think it is: once a race is cancelled or something, another player cannot start it or so. not remember exactly what it was.
@Sebastian

I just copy racing system from this forum not sure about any module,  RPickup.Remove(); should remove the pickups after racing get cancelled but its gives error

Diego^

Could you show the function that creates the race?
BRL's Developer.

Nihongo^

Quote from: Diego^ on Apr 12, 2023, 10:06 PMCould you show the function that creates the race?

function startrace()
{
    racestart = true;
    CreateMarker(0, Vector( 10.1409, 963.899, 10.9402 ), 5, RGB(128,0,128), 0 );
    RPickup<-CreatePickup( 382, 0, 1, Vector( -1435.9, -790.299, 14.6437 ), 255, false );
local plr;
      for( local i=0; i <= GetMaxPlayers(); i++ )
  {
  {
      plr = FindPlayer( i );
      if ( ( plr ) && ( status[ plr.ID ].raceplayer ) )
                {
                    plr.IsFrozen = false;
                }
        }
}
}



Gito Baloch

#8
Quoteif( Stats[ plr.ID ].raceplayer )
    {
                    Stats[ plr.ID ].raceplayer = false;
                    plr.IsFrozen = false;
                    plr.Pos = Vector( 496.26, -83.9443, 10.0302  );
    }

You are using Stats as an array here

Quoteif ( ( plr ) && ( status[ plr.ID ].raceplayer ) )
                {
                    plr.IsFrozen = false;
                }

and status here, check it, it might be causing error
Programming is the language I speak, the world I shape, and the future I code

Diego^

I advise you to add in onScriptLoad(): RPickup <- null;

And replace: RPickup.Remove();
Per: if ( RPickup ) RPickup.Remove();
BRL's Developer.

Nihongo^

Quote from: Diego^ on Apr 13, 2023, 08:17 PMI advise you to add in onScriptLoad(): RPickup <- null;

And replace: RPickup.Remove();
Per: if ( RPickup ) RPickup.Remove();


Thank you so much its works you solved my problem