veh geting wrong place

Started by Cool, May 14, 2016, 12:15 AM

Previous topic - Next topic

Cool

see here if i change the vehicles id  id 1 to 52 then its start teleporting me to unknown place if i again change to 1 then its working whats going on with me :-\ :-\
if( cmd == "race") {
 if( race ) MessagePlayer("Race is already started.. ",player);
 else{
  race = true;
  Message("Race is started by "+ player.Name +", 20sec to join the race.");
  Message("Film Studio to Airport race started.");
  NewTimer( "raceplayers", 20000, 1);
  FindVehicle( 1 ).Pos = Vector( -54.2794, 966.151, 15.9403 );
  FindVehicle( 2 ).Pos = Vector( -54.2794, 956.151, 15.9403 );
  FindVehicle( 3 ).Pos = Vector( -54.2794, 946.151, 15.9403 );
  FindVehicle( 4 ).Pos = Vector( -54.2794, 936.151, 15.9403 );
 }
 }
 else if( cmd == "joinrace") {
 if ( !player.Spawned )MessagePlayer("Spawn to use this command" player);
 else if ( !race ) MessagePlayer("Race is not started do /race", player);
 else if ( pstats[player.ID].raceplayer ) MessagePlayer("You already joined race.",player);
 else if ( racecount > 4 ) MessagePlayer("Too Late! Only 4 players can race at once", player);
 else if ( racestart ) MessagePlayer("Too Late!", player);
 else {
  racecount++;
   for( local i=0; i <= racecount; i++ )
  {
   local plr = FindPlayer( i );
   player.Vehicle = FindVehicle( i );
  }
  player.Frozen = true;
  pstats[player.ID].raceplayer = true;
  Message(""+ player.Name +" has joined race.")
 }
 }

Coolkid

It will teleport you to the car loc because it allows maximum 4 players and see join race command it uses maximum cars to teleport players to cars from us 1 to 4 if you change vehicle id to 52 then I'd 52 will go release to the race loc but I'd 1 will be in normal positron but you will be teleported to 1 so you need to change your join race cmd a little I am on mobile will fix it tomorrow

Cool


jayant

You should check your for loop..

KAKAN

yes.
Set the race count to 53.
Then, when you change player's pos, use this:
player.Pos = FindVehicle( ++racecount ).Pos;
oh no

Cool

Quote from: KAKAN on May 14, 2016, 09:59 AMyes.
Set the race count to 53.
Then, when you change player's pos, use this:
player.Pos = FindVehicle( ++racecount ).Pos;
if( cmd == "race") {
 if( race ) MessagePlayer("Race is already started.. ",player);
 else{
  race = true;
  Message("Race is started by "+ player.Name +", 20sec to join the race.");
  Message("Film Studio to Airport race started.");
  NewTimer( "raceplayers", 20000, 1);
  FindVehicle( 1 ).Pos = Vector( -54.2794, 966.151, 15.9403 );
  FindVehicle( 2 ).Pos = Vector( -54.2794, 956.151, 15.9403 );
  FindVehicle( 3 ).Pos = Vector( -54.2794, 946.151, 15.9403 );
  FindVehicle( 4 ).Pos = Vector( -54.2794, 936.151, 15.9403 );
 }
 }
 else if( cmd == "joinrace") {
 if ( !player.Spawned )MessagePlayer("Spawn to use this command" player);
 else if ( !race ) MessagePlayer("Race is not started do /race", player);
 else if ( pstats[player.ID].raceplayer ) MessagePlayer("You already joined race.",player);
 else if ( racecount > 4 ) MessagePlayer("Too Late! Only 4 players can race at once", player);
 else if ( racestart ) MessagePlayer("Too Late!", player);
 else {
  racecount++53;
   for( local i=0; i <= racecount; 53 )
  {
  player.Pos = FindVehicle( ++racecount ).Pos;
  }
  player.Frozen = true;
  pstats[player.ID].raceplayer = true;
  Message(""+ player.Name +" has joined race.")
 }
 }
is its right

Coolkid

Nooe now u r selecting 53 players

KAKAN

Quote from: Coolkid on May 15, 2016, 01:18 PMNooe now u r selecting 53 players
Don't you know that Hercules is a PR0?
@Hercules, here's a fixed one:
if(cmd=="joinrace")
 {
  if(!player.Spawned) MessagePlayer("Please spawn noob",player);
  else if( !race ) MessagePlayer("Race has not started, sux dix now!",player);
  else if( pstats[ player.ID ].raceplayer ) MessagePlayer("You iz in race pich",player);
  else if( racecount >= 4 ) MessagePlayer("only 4 playerz, plz!",player);
  else if( racestart ) MessagePlayer("Too late!",player);
  else
  {
    racecount++;
    player.IsFrozen = true;
    player.Pos = FindVehicle( racecount ).Pos;
    pstats[ player.ID ].raceplayer = true;
    Message( player.Name + " has joined race!" );
  }
 }
oh no