[Include] Car damage system - Damage a car without a driver!
#16

I'm wondering, I only did a same stock just like the IsVehicleOccupied (Almost same coding, but even less optimized ), wouldn't it be more efficient if you'd use it like this?

pawn Код:
new bool:VehicleOccupied[MAX_VEHICLES];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(newstate == PLAYER_STATE_DRIVER)
  {
    VehicleOccupied[GetPlayerVehicleID(playerid) - 1] = true;
    SetPVarInt(playerid, "InVehicle", GetPlayerVehicleID(playerid));
  }
  if(oldstate == PLAYER_STATE_DRIVER)
  {
    VehicleOccupied[GetPVarInt(playerid, "InVehicle") - 1] = false;
    DeletePVar(playerid, "InVehicle");
  }
  return 1;
}

stock bool:IsVehicleOccupied(vehicleid) //Are bools needed here? :D
{
  return VehicleOccupied[vehicleid - 1];
}
Just an idea of what I think might be a bit efficienter, correct me if I'm wrong. Now I'm gonna try this at home :P
Reply


Messages In This Thread
Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:00
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:07
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:08
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:09
Re: Car damage system - Damage a car without a driver! - by GaGlets(R) - 02.11.2010, 00:11
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 00:13
Re: Car damage system - Damage a car without a driver! - by Camacorn - 02.11.2010, 00:21
Re: Car damage system - Damage a car without a driver! - by willsuckformoney - 02.11.2010, 00:32
Re: Car damage system - Damage a car without a driver! - by ViruZZzZ_ChiLLL - 02.11.2010, 00:55
Re: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 07:08
Re: Car damage system - Damage a car without a driver! - by iJumbo - 02.11.2010, 14:52
Re: Car damage system - Damage a car without a driver! - by Brian_Furious - 02.11.2010, 15:03
Re: Car damage system - Damage a car without a driver! - by juuleman - 02.11.2010, 15:11
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 16:41
Re: Car damage system - Damage a car without a driver! - by WillyP - 02.11.2010, 16:44
Re: Car damage system - Damage a car without a driver! - by Hiddos - 02.11.2010, 16:46
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 17:08
Re: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 17:22
AW: Car damage system - Damage a car without a driver! - by Trooper[Y] - 02.11.2010, 17:24
Re: AW: Car damage system - Damage a car without a driver! - by Slice - 02.11.2010, 17:27
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 17:29
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 18:10
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 02.11.2010, 20:54
Re: Car damage system - Damage a car without a driver! - by Retardedwolf - 03.11.2010, 05:48
Re: Car damage system - Damage a car without a driver! - by titanak - 03.11.2010, 15:46
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 03.11.2010, 18:34
Re: Car damage system - Damage a car without a driver! - by jasonnw666 - 03.11.2010, 20:00
Re: Car damage system - Damage a car without a driver! - by jasonnw666 - 04.11.2010, 18:34
Re: Car damage system - Damage a car without a driver! - by cmg4life - 05.11.2010, 16:56
Re: Car damage system - Damage a car without a driver! - by Georgelopez1 - 11.01.2011, 20:13
Re: Car damage system - Damage a car without a driver! - by LZLo - 04.02.2011, 20:34
Re: Car damage system - Damage a car without a driver! - by Tama - 20.03.2011, 07:50
Re: Car damage system - Damage a car without a driver! - by Venice - 23.03.2011, 06:54
Re: Car damage system - Damage a car without a driver! - by The_Moddler - 31.03.2011, 23:42
Re: Car damage system - Damage a car without a driver! - by okami13 - 18.06.2011, 13:06
AW: Car damage system - Damage a car without a driver! - by ULLLIIK - 18.06.2011, 14:16
Re: Car damage system - Damage a car without a driver! - by itachipirate - 31.01.2012, 23:10
Re: Car damage system - Damage a car without a driver! - by oscar7610 - 30.03.2012, 00:00
Re: Car damage system - Damage a car without a driver! - by Skribblez - 30.03.2012, 01:38

Forum Jump:


Users browsing this thread: 2 Guest(s)