SA-MP Forums Archive
This I need help with - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: This I need help with (/showthread.php?tid=319143)



This I need help with - Buzzbomb - 18.02.2012

I have A new Variable Called
pawn Код:
new AutoSalesVehicle[9];
And I have a new public..Under
pawn Код:
forward DealerVehicles(playerid,vehicleid);
public DealerVehicles(playerid,vehicleid)
{
    AutoSalesVehicle[0] = AddStaticVehicle(541,538.4867,-1282.8323,17.2422,185.1891,-1,-1);// Bullet
    AutoSalesVehicle[1] = AddStaticVehicle(402,537.8731,-1273.0552,17.8527,308.4883,-1,-1);// Buffalo
    AutoSalesVehicle[2] = AddStaticVehicle(444,547.4461,-1267.4044,16.9855,12.8657,-1,-1);// Monster
    AutoSalesVehicle[3] = AddStaticVehicle(439,550.8978,-1264.9133,16.9855,11.1392,-1,-1);// Stallion
    AutoSalesVehicle[4] = AddStaticVehicle(565,548.6735,-1287.4486,16.9918,357.9976,-1,-1);// Flash
    AutoSalesVehicle[5] = AddStaticVehicle(451,544.8066,-1284.0590,16.9887,178.2442,-1,-1);// Turismo
    AutoSalesVehicle[6] = AddStaticVehicle(400,561.1696,-1287.6387,16.9916,358.8935,-1,-1);// LandStalker
    AutoSalesVehicle[7] = AddStaticVehicle(554,564.5045,-1287.7549,16.9918,359.0627,-1,-1);// Yosemite
    AutoSalesVehicle[8] = AddStaticVehicle(411,552.0139,-1287.6346,16.9919,357.9609,-1,-1);// Infernus
    return 1;
}
And I'm trying to get This to Work Right I want to Create a price list for Each Vehicles from [0] to [9] I can do the price thing.. But what im having the most Difficult is Trying to Get The coordinates of each vehicle and add a 3Dtextlabel I know i can just create the 3dtextlabel in the vehicle x,y,z But im trying to make it simple so i don't half to do all of it.. If anyone has any ideal how i could Count How many AutoSalesVehicles There is and Create a 3dTextlabel For Each Vehicle that would be most appreciated..


Re: This I need help with - KingHual - 18.02.2012

for(new i, i<9, i++)
{
//get the coordinates and add the 3Dtextlabel
}


Re: This I need help with - Buzzbomb - 20.02.2012

Do what... How is that going to Count the AutoSalesVehicles?

And Return a 3dtextlabel for each dealervehicle.. In the vehicle Position


Re: This I need help with - chrism11 - 20.02.2012

To Get the count of vehicles do

Код:
stock GetVehicleCount()
{
	new count;
	for(new i = 0; i != 9; i++)
	{
		if(AutoSalesVehicle[i] != INVALID_VEHICLE_ID) count ++;
	}
	return count;
}
to set a textlabel above the vehicle do

Код:
new vehicle3Dtext[MAX_VEHICLES]; // at the top of the script
stock AttachTextLabelToVehicle(vehicleid)
{
    vehicle3Dtext[vehicleid] = Create3DTextLabel( "Autobahn Vehicle", 0x000000FF, 0.0, 0.0, 0.0, 50.0, 0, 1 );
	Attach3DTextLabelToVehicle( vehicle3Dtext, vehicleid, 0.0, 0.0, 2.0);
	return 1;
}
+ rep if i helped pls, and also ill be checking the topic if you still need something