Scripting Problem - Car System Issue.
#1

Dear helpers,

When I was scripting my server I found out some problem.
The cars I changed are now with a totally other name and price.
I did not delete any cars out of the cars.cfg or AddStaticVehicleEx.

Also I tried to run it with the original cars.cfg and then it also says a Mesa is a Huntley and that sort of things.


Код:
500,12.475996,-224.267196,5.363296,89.560600,3,0,Dealership,Mesa,85000,,0,0
500,12.483200,-232.355499,5.360300,90.891799,37,1,Dealership,Mesa,85000,,0,0
566,12.718500,-240.742095,5.361100,90.534202,66,66,Dealership,Tahoma,100000,,0,0
566,13.144700,-249.079803,5.363100,89.851600,79,79,Dealership,Tahoma,100000,,0,0
400,12.934200,-257.297485,5.364200,89.123703,7,7,Dealership,Landstalker,125000,,0,0
400,13.295800,-265.450500,5.362998,88.933998,86,86,Dealership,Landstalker,125000,,0,0
555,-32.332401,-273.394805,5.357600,269.898590,3,0,Dealership,Windsor,160000,,0,0
555,-31.829200,-280.020904,5.357800,270.051605,0,0,Dealership,Windsor,160000,,0,0
475,-32.181198,-286.856506,5.359498,270.023406,1,0,Dealership,Sabre,75000,,0,0
475,-31.638700,-293.662994,5.362895,269.951110,86,86,Dealership,Sabre,75000,,0,0
492,0.111000,-301.238006,5.209957,89.606430,1,0,Dealership,Greenwood,80000,,0,0
542,-0.025100,-308.101196,5.361700,89.691200,86,86,Dealership,Clover,75000,,0,0
542,-0.001597,-315.259704,5.361800,88.784797,0,1,Dealership,Clover,75000,,0,0
466,-0.311699,-322.423492,5.364500,90.137496,11,11,Dealership,Glendale,90000,,0,0
466,-0.554498,-329.108001,5.364099,89.976600,3,3,Dealership,Glendale,90000,,0,0
549,0.242798,-336.341003,5.364200,90.186996,1,1,Dealership,Tampa,65000,,0,0
549,0.101199,-343.271392,5.363296,90.341102,0,0,Dealership,Tampa,65000,,0,0
602,-0.424899,-350.562194,5.363200,90.682701,11,0,Dealership,Alpha,140000,,0,0
602,0.090800,-357.329589,5.361598,89.805099,0,0,Dealership,Alpha,140000,,0,0
585,-0.726997,-364.634185,5.015500,89.296699,-1,-1,Dealership,Emperor,90000,,0,0
478,0.347698,-377.970611,5.361299,359.517791,0,0,Dealership,Walton,80000,,0,0
478,-6.301795,-378.166900,5.355800,358.901794,25,1,Dealership,Walton,80000,,0,0
579,-13.113200,-378.369201,5.363800,359.419403,44,44,Dealership,Huntley,200000,,0,0
579,-19.705099,-378.385009,5.361598,359.809204,0,0,Dealership,Huntley,200000,,0,0
554,-26.361700,-378.472686,5.361196,0.860898,0,0,Dealership,Yosemite,100000,,0,0
554,-33.007900,-378.217010,5.358200,0.352699,101,1,Dealership,Yosemite,100000,,0,0
422,-39.762699,-377.824401,5.362895,0.604600,86,0,Dealership,Bobcat,50000,,0,0
422,-46.460899,-377.762908,5.355000,0.677900,0,1,Dealership,Bobcat,50000,,0,0
575,-53.175800,-378.665008,5.364398,1.467900,44,0,Dealership,Broadway,130000,,0,0
575,-59.862998,-378.833496,5.361800,359.617309,0,0,Dealership,Broadway,130000,,0,0
533,-66.634803,-378.093505,5.362298,0.891300,45,32,Dealership,Feltzer,160000,,0,0
533,-73.048301,-378.154998,5.361400,358.975097,0,0,Dealership,Feltzer,160000,,0,0
576,-62.587799,-324.937713,5.355895,270.117797,7,7,Dealership,Tornado,90000,,0,0
576,-62.637798,-317.943908,5.362298,269.935302,6,0,Dealership,Tornado,90000,,0,0
489,-62.523799,-310.906890,5.362699,269.915191,120,123,Dealership,Rancher,150000,,0,0
489,-62.433898,-304.026885,5.360898,269.859588,14,123,Dealership,Rancher,150000,,0,0
509,-54.353199,-215.417892,4.942296,170.540100,0,0,Dealership,Bike,6000,,0,0
509,-50.383998,-214.920898,4.942200,173.219406,0,0,Dealership,Bike,6000,,0,0
509,-46.428199,-215.148803,4.941699,177.762496,0,0,Dealership,Bike,6000,,0,0
509,-42.527999,-215.855300,4.941699,175.098800,86,86,Dealership,Bike,6000,,0,0
468,-38.596500,-216.072204,4.941895,172.820007,58,1,Dealership,Sanchez,20000,,0,0
468,-34.543899,-216.003799,4.941998,174.081604,0,6,Dealership,Sanchez,20000,,0,0
461,-30.624700,-216.949600,4.939599,172.680404,1,6,Dealership,PCJ-600,45000,,0,0
461,-26.643699,-216.952896,4.942100,173.400497,1,1,Dealership,PCJ-600,45000,,0,0
471,-22.875900,-217.704299,4.939700,171.802703,0,0,Dealership,Quad,60000,,0,0
471,-18.523700,-217.990402,4.942296,176.606002,75,0,Dealership,Quad,60000,,0,0
411,475.129089,880.212097,-30.212900,273.516601,70,70,Dealership,Infernus,420000,,0,0
559,475.129089,880.212097,-30.212900,273.516601,3,3,Dealership,Jester,240000,,0,0
561,475.129089,880.212097,-30.212900,273.516601,8,17,Dealership,Stratum,230000,,0,0
560,475.129089,880.212097,-30.212900,273.516601,11,0,Dealership,Sultan,270000,,0,0
558,475.129089,880.212097,-30.212900,273.516601,117,1,Dealership,Uranus,245000,,0,0
477,475.129089,880.212097,-30.212900,273.516601,94,1,Dealership,ZR-350,280000,,0,0
451,475.129089,880.212097,-30.212900,273.516601,6,0,Dealership,Turismo,420000,,0,0
462,475.129089,880.212097,-30.212900,273.516601,7,7,Dealership,Faggio,10000,,0,0
462,475.129089,880.212097,-30.212900,273.516601,79,79,Dealership,Faggio,10000,,0,0
462,475.129089,880.212097,-30.212900,273.516601,0,0,Dealership,Faggio,10000,,0,0
461,475.129089,880.212097,-30.212900,273.516601,6,6,Dealership,PCJ-600,40000,,0,0
461,525.666870,814.755126,-26.068399,202.362304,0,0,Dealership,PCJ-600,40000,,0,0
461,525.666870,814.755126,-26.068399,202.362304,3,0,Dealership,PCJ-600,40000,,0,0
461,525.666870,814.755126,-26.068399,202.362304,43,43,Dealership,PCJ-600,40000,,0,0
461,525.666870,814.755126,-26.068399,202.362304,0,0,Dealership,PCJ-600,40000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,3,0,Dealership,Freeway,30000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,79,79,Dealership,Freeway,30000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,3,1,Dealership,Freeway,30000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,3,3,Dealership,Freeway,30000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,0,0,Dealership,Freeway,30000,,0,0
463,525.666870,814.755126,-26.068399,202.362304,0,0,Dealership,Freeway,30000,,0,0
445,586.939025,763.166381,-16.204399,246.422897,39,39,Dealership,Admiral,90000,,0,0
445,586.939025,763.166381,-16.204399,246.422897,45,45,Dealership,Admiral,90000,,0,0
492,586.939025,763.166381,-16.204399,246.422897,81,27,Dealership,Greenwood,80000,,0,0
518,586.939025,763.166381,-16.204399,246.422897,33,0,Dealership,Buccaneer,60000,,0,0
566,586.939025,763.166381,-16.204399,246.422897,95,1,Dealership,Tahoma,80000,,0,0
567,586.939025,763.166381,-16.204399,246.422897,90,96,Dealership,Savanna,80000,,0,0
580,586.939025,763.166381,-16.204399,246.422897,67,67,Dealership,Stafford,75000,,0,0
600,702.977172,746.758911,-5.443600,260.788604,67,8,Dealership,Picador,60000,,0,0
468,702.977172,746.758911,-5.443600,260.788604,46,46,Dealership,Sanchez,40000,,0,0
468,702.977172,746.758911,-5.443600,260.788604,3,3,Dealership,Sanchez,40000,,0,0
468,702.977172,746.758911,-5.443600,260.788604,53,53,Dealership,Sanchez,40000,,0,0
481,702.977172,746.758911,-5.443600,260.788604,46,46,Dealership,BMX,5000,,0,0
481,758.882019,894.747375,-1.702200,123.448898,14,1,Dealership,BMX,5000,,0,0
481,758.882019,894.747375,-1.702200,123.448898,26,1,Dealership,BMX,5000,,0,0
481,758.882019,894.747375,-1.702200,123.448898,3,3,Dealership,BMX,5000,,0,0
509,758.882019,894.747375,-1.702200,123.448898,25,1,Dealership,Bike,5000,,0,0
509,758.882019,894.747375,-1.702200,123.448898,36,1,Dealership,Bike,5000,,0,0
This bug came up a while after I moved all unused cars (from the infernus to below) to the Querry.
The second Quad is the last vehicle I need from the list, the others I dropped down in the Querry so it won't bother anyone.
In total it are 84 cars, just like in the original cars.cfg.


Код:
public IsAnOwnableCar(vehicleid)
{
	if(vehicleid >= 184 && vehicleid <= 268) { return 1; }
	return 0;
}
Also here there are 84 cars.



He now thinks that the green Clover you see on the far left, is the Glendale which I'm in now.
I know that because if I enter the Glendale next to this grey one, it also says Clover.
When I sit in the black/white Clover it says I'm in a Greenwood, there is a Greenwood next to the green Clover.

I hope someone could help me out through this forum.


Yours faithfully,

Intenso.
Reply
#2

Woah, that's really weird. Maybe a SA:MP bug..
Reply
#3

Dear Admin/Forum Moderator,

When you read this you might think "Wtf you doing in this section /delete.".
But I just (three seconds ago) I noticed there was a Scripting Support thread.
Please move it to there instead of deleting it.
I would appreciate it.


Intenso.
Reply
#4

Quote:
Originally Posted by Abernethy
Woah, that's really weird. Maybe a SA:MP bug..
I don't think it's a SA:MP bug.
I think it's a scripting issue but I've no idea where I have to search.
Reply
#5

I found out that the first car ID was 182 and the last 265.
So I changed the Public IsAnOwnableCar into this:

Код:
public IsAnOwnableCar(vehicleid)
{
	if(vehicleid >= 182 && vehicleid <= 265) { return 1; }
	return 0;
}
But when I entered the server and got in car ID 182 it looked like this:

Reply
#6

that happens to me too
Reply
#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
#8

I Had This But Found The Solution, Are You Using Larp By Any Chance If Yes This Is What You Do
in the .CFG Every Car Must Be On Its Own Line Like This

Код:
429,1708.289062,-1005.085998,23.593708,171.886306,86,86,Dealership,Banshee,170000,,0,0
429,1740.041625,-1085.380493,23.640619,359.193389,0,1,Dealership,Banshee,170000,,0,0
424,1749.196411,-1085.082519,23.741926,1.448104,11,11,Dealership,BFG,170000,,0,0
424,1780.059936,-1070.729492,23.741380,180.197860,3,3,Dealership,BFG,170000,,0,0
451,1767.333007,-1017.899475,23.668180,152.273559,3,0,Dealership,Turismo,420000,,0,0
451,1784.451782,-1070.270874,23.667577,180.092803,1,1,Dealership,Turismo,420000,,0,0
470,1783.167358,-1026.791870,23.953023,152.099334,11,0,Dealership,Patriot,90000,,0,0
Not Like This

Код:
429,1708.289062,-1005.085998,23.593708,171.886306,86,86,Dealership,Banshee,170000,,0,0429,1740.041625,-1085.380493,23.640619,359.193389,0,1,Dealership,Banshee,170000,,0,0424,1749.196411,-1085.082519,23.741926,1.448104,11,11,Dealership,BFG,170000,,0,0424,1780.059936,-1070.729492,23.741380,180.197860,3,3,Dealership,BFG,170000,,0,0451,1767.333007,-1017.899475,23.668180,152.273559,3,0,Dealership,Turismo,420000,,0,0451,1784.451782,-1070.270874,23.667577,180.092803,1,1,Dealership,Turismo,420000,,0,0470,1783.167358,-1026.791870,23.953023,152.099334,11,0,Dealership,Patriot,90000,,0,0
I Fixed it on my server, and now i have 200 Ownablecars
Reply
#9

Joe, it says than OwnableVehicle does not match definition

Код:
warning 202: number of arguments does not match definition
Код:
OwnableVehicle[gOwnableVehicles]=CreateVehicle(522,0,0,0,-1,-1);gOwnableVehicles++;
Reply
#10

Quote:
Originally Posted by kukars22
Joe, it says than OwnableVehicle does not match definition

Код:
warning 202: number of arguments does not match definition
Код:
OwnableVehicle[gOwnableVehicles]=CreateVehicle(522,0,0,0,-1,-1);gOwnableVehicles++;
Are you seriously going to create an NRG-500 at the coordinates: 0,0,0 ? Please read the code before blatantly copying and pasting it. Don't forget the Respawn_delay parameter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)