Scripting Problem - Car System Issue.
#7

That same method of vehicle checking is used in GF/PEN and it SUCKS! That means every single time you add/remove a vehicle you have to recalculate all of those functions.

Here's what I would use
pawn Код:
//Up top
new OwnableVehicle[MAX_VEHICLES];
new gOwnableVehicles; //Just an integer to keep track of how many you have
// Example OnGameModeInit
public OnGameModeInit()
{
  OwnableVehicle[gOwnableVehicles]=CreateVehicle(522,0,0,0,-1,-1);gOwnableVehicles++; //Creates the vehicle and adds 1 to gOwnableVehicles
  OwnableVehicle[gOwnableVehicles]=CreateVehicle(411,0,0,0,-1,-1);gOwnableVehicles++;
  OwnableVehicle[gOwnableVehicles]=CreateVehicle(487,0,0,0,-1,-1);gOwnableVehicles++;
}

public IsanOwnableCar(vehicleid)
{
  for(new o; o<gOwnableVehicles;o++)if(OwnableVehicle[o]==vehicleid)return 1;
  return 0;
}
Then you would never have to worry about changing anything ever again, and you could also create ownable cars midgame using something like this

pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
  if(!strcmp(cmdtext[1],"ownveh",true,6))
  {
    if((strval(cmdtext[8])>612)||(strval(cmdtext[8]<400))return SendClientMessage(playerid,0xFF0000FF,"Invalid Vehicle Type!");
    if(gOwnableVehicles>=MAX_VEHICLES)return 0; //If for some reason you have more ownable vehicles than you do none-ownable vehicles
    OwnableVehicle[gOwnableVehicles]=CreateVehicle(strval(cmdtext[8]),X,Y,Z,-1,-1);
    gOwnableVehicles++;
    return SendClientMessage(playerid,0xFF0000FF,"OwnableVehicle Created!");
  }
}
Reply


Messages In This Thread
Scripting Problem - Car System Issue. - by Intenso - 06.06.2009, 10:36
Re: Scripting Problem - Car System Issue. - by Abernethy - 06.06.2009, 10:38
Re: Scripting Problem - Car System Issue. - by Intenso - 06.06.2009, 10:52
Re: Scripting Problem - Car System Issue. - by Intenso - 06.06.2009, 14:28
Re: Scripting Problem - Car System Issue. - by Intenso - 06.06.2009, 15:11
Re: Scripting Problem - Car System Issue. - by Lilcuete - 25.11.2009, 01:56
Re: Scripting Problem - Car System Issue. - by Joe Staff - 25.11.2009, 04:14
Re: Scripting Problem - Car System Issue. - by Los Santos RP - 25.11.2009, 21:56
Re: Scripting Problem - Car System Issue. - by kukars22 - 27.11.2009, 05:16
Re: Scripting Problem - Car System Issue. - by Joe Staff - 27.11.2009, 07:48

Forum Jump:


Users browsing this thread: 1 Guest(s)