SA-MP Forums Archive
Help with selecting data - 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: Help with selecting data (/showthread.php?tid=587422)



Help with selecting data - JessThompson - 30.08.2015

Okay I have this -


Код:
enum DScars
{
	DSCarName[50],
	DSVehicleClass,
	DSCarModel,
	DSPrice
}
new DScarBuy[][DScars] =
{
//	{"VEHICLE NAME",	VEHICLE TYPE ID,	VEHICLE ID,		VEHICLE PRICE}  //

	{"Admiral", 						1, 445, 50000},
	{"Alpha", 							2, 602, 50000},
	{"Ambulance", 						3, 416, 50000},
	{"Andromada", 						4, 592, 50000},
	{"Article Trailer", 				6, 591, 50000},
//	{"AT400", 							4, 577, 50000},
	{"Baggage", 						5, 485, 50000},
	{"Baggage Trailer A", 				6, 606, 50000},
	{"Baggage Trailer B", 				6, 607, 50000},
	{"Bandito", 						8, 568, 50000},
	{"Banshee", 						2, 429, 50000},
	{"Barracks", 						3, 433, 50000},
	{"Beagle", 							4, 511, 50000},
	{"Benson", 							7, 499, 50000},
	{"Berkley's RC Van", 				7, 459, 50000},
	{"BF Injection", 					8, 424, 50000},
	{"BF-400", 							9, 581, 50000},
	{"Bike", 							9, 509, 50000},
	{"Blade", 						   10, 536, 50000},
	{"Blista Compact", 					2, 496, 50000},
	{"Bloodring Banger", 				1, 504, 50000},
	{"BMX", 							9, 481, 50000},
	{"Bobcat", 							7, 422, 50000},
	{"Boxville 1", 						7, 498, 50000},
	{"Boxville 2", 						7, 609, 50000},
	{"Bravura", 						1, 401, 50000},
	{"Broadway", 					   10, 575, 50000},
//	{"Brownstreak (train)", 			5, 538, 50000},
	{"Buccaneer", 						1, 518, 50000},
	{"Buffalo", 						2, 402, 50000},
	{"Bullet", 							2, 541, 50000},
	{"Burrito", 						7, 482, 50000},
	{"Bus", 							3, 431, 50000},
	{"Cabbie", 							3, 438, 50000},
	{"Caddy", 							5, 457, 50000},
	{"Cadrona", 						1, 527, 50000},
	{"Camper", 							5, 483, 50000},
	{"Cargo Trailer", 					6, 435, 50000},
	{"Cargobob", 		   			   11, 548, 50000},
	{"Cement Truck", 					7, 524, 50000},
	{"Cheetah", 						2, 415, 50000},
	{"Clover", 							1, 542, 50000},
	{"Club", 							2, 589, 50000},
	{"Coach", 							3, 437, 50000},
	{"Coastguard", 					   12, 472, 50000},
	{"Combine Harvester", 				5, 532, 50000},
	{"Comet", 						   13, 480, 50000},
	{"Cropduster", 						4, 512, 50000},
	{"DFT-30", 							7, 578, 50000},
	{"Dinghy", 						   12, 473, 50000},
	{"Dodo", 							4, 593, 50000},
	{"Dozer", 							5, 486, 50000},
	{"Dumper", 							5, 406, 50000},
	{"Dune", 							8, 573, 50000},
	{"Elegant", 						1, 507, 50000},
	{"Elegy", 							1, 562, 50000},
	{"Emperor", 						1, 585, 50000},
	{"Enforcer", 						3, 427, 50000},
	{"Esperanto", 						1, 419, 50000},
	{"Euros", 							2, 587, 50000},
	{"Faggio", 							9, 462, 50000},
	{"Farm Trailer", 					6, 610, 50000},
	{"FBI Rancher", 					3, 490, 50000},
	{"FBI Truck", 						3, 528, 50000},
	{"FCR-900", 						9, 521, 50000},
	{"Feltzer", 					   13, 533, 50000},
	{"Firetruck", 						3, 407, 50000},
	{"Firetruck LA", 					3, 544, 50000},
	{"Flash", 							2, 565, 50000},
	{"Flatbed", 						7, 455, 50000},
	{"Fluids Trailer", 					6, 584, 50000},
	{"Forklift", 						5, 530, 50000},
	{"Fortune", 						1, 526, 50000},
	{"Freeway", 						9, 463, 50000},
//	{"Freight (train)", 				5, 537, 50000},
//	{"Freight Box Trailer (train)", 	6, 590, 50000},
//	{"Freight Flat Trailer (train)", 	6, 569, 50000},
	{"Glendale", 						1, 466, 50000},
	{"Glendale Shit", 					1, 604, 50000},
	{"Greenwood", 						1, 492, 50000},
	{"Hermes", 							1, 474, 50000},
	{"Hotdog", 							5, 588, 50000},
	{"Hotknife", 						5, 434, 50000},
	{"Hotring Racer 1", 				2, 494, 50000},
	{"Hotring Racer 2", 				2, 502, 50000},
	{"Hotring Racer 3", 				2, 503, 50000},
	{"HPV1000", 						3, 523, 50000},
	{"Hunter", 						   11, 425, 50000},
	{"Huntley", 						8, 579, 50000},
	{"Hustler", 						5, 545, 50000},
	{"Hydra", 							4, 520, 50000},
	{"Infernus", 						2, 411, 50000},
	{"Intruder", 						1, 546, 50000},
	{"Jester", 							2, 559, 50000},
	{"Jetmax", 						   12, 493, 50000},
	{"Journey", 						5, 508, 50000},
	{"Kart", 							5, 571, 50000},
	{"Landstalker", 					8, 400, 50000},
	{"Launch", 						   12, 595, 50000},
	{"Leviathan", 					   11, 417, 50000},
	{"Linerunner", 						7, 403, 50000},
	{"Majestic", 						1, 517, 50000},
	{"Manana", 							1, 410, 50000},
	{"Marquis", 					   12, 484, 50000},
	{"Maverick", 					   11, 487, 50000},
	{"Merit", 							1, 551, 50000},
	{"Mesa", 							8, 500, 50000},
	{"Monster", 						8, 444, 50000},
	{"Monster A", 						8, 556, 50000},
	{"Monster B", 						8, 557, 50000},
	{"Moonbeam", 					   14, 418, 50000},
	{"Mountain Bike", 					9, 510, 50000},
	{"Mower", 							5, 572, 50000},
	{"Mr Whoopee", 						5, 423, 50000},
	{"Mule", 							7, 414, 50000},
	{"Nebula", 							1, 516, 50000},
	{"Nevada", 							4, 553, 50000},
	{"Newsvan", 						7, 582, 50000},
	{"NRG-500", 						9, 522, 50000},
	{"Oceanic", 						1, 467, 50000},
	{"Ore Trailer", 					6, 450, 50000},
	{"Packer", 							7, 443, 50000},
	{"Patriot", 						8, 470, 50000},
	{"PCJ-600", 						9, 461, 50000},
	{"Perenniel", 					   14, 404, 50000},
	{"Phoenix", 						2, 603, 50000},
	{"Picador", 						7, 600, 50000},
	{"Pizzaboy", 						9, 448, 50000},
	{"Police Car (LSPD)", 				3, 596, 50000},
	{"Police Car (LVPD)", 				3, 598, 50000},
	{"Police Car (SFPD)", 				3, 597, 50000},
	{"Police Maverick", 			   11, 497, 50000},
	{"Police Ranger", 					3, 599, 50000},
	{"Pony", 							7, 413, 50000},
	{"Predator", 					   12, 430, 50000},
	{"Premier", 						1, 426, 50000},
	{"Previon", 						1, 436, 50000},
	{"Primo", 							1, 547, 50000},
	{"Quad", 							9, 471, 50000},
	{"Raindance", 					   11, 563, 50000},
	{"Rancher 1", 						8, 489, 50000},
	{"Rancher 2", 						8, 505, 50000},
//	{"RC Bandit", 					   15, 441, 50000},
//	{"RC Baron", 					   15, 464, 50000},
//	{"RC Cam", 						   15, 594, 50000},
//	{"RC Goblin", 					   15, 501, 50000},
//	{"RC Raider", 					   15, 465, 50000},
//	{"RC Tiger", 					   15, 564, 50000},
	{"Reefer", 						   12, 453, 50000},
	{"Regina", 						   14, 479, 50000},
	{"Remington", 					   10, 534, 50000},
	{"Rhino", 							3, 432, 50000},
	{"Roadtrain", 						7, 515, 50000},
	{"Romero", 							5, 442, 50000},
	{"Rumpo", 							7, 440, 50000},
	{"Rustler", 						4, 476, 50000},
	{"Sabre", 							2, 475, 50000},
	{"Sadler", 							7, 543, 50000},
	{"Sadler Shit", 					7, 605, 50000},
	{"SAN News Maverick", 			   11, 488, 50000},
	{"Sanchez", 						9, 468, 50000},
	{"Sandking", 						8, 495, 50000},
	{"Savanna", 					   10, 567, 50000},
	{"Seasparrow", 					   11, 447, 50000},
	{"Securicar", 						5, 428, 50000},
	{"Sentinel", 						1, 405, 50000},
	{"Shamal", 							4, 519, 50000},
	{"Skimmer", 						4, 460, 50000},
	{"Slamvan", 					   10, 535, 50000},
	{"Solair", 						   14, 458, 50000},
	{"Sparrow", 					   11, 469, 50000},
	{"Speeder", 					   12, 452, 50000},
	{"Squallo", 					   12, 446, 50000},
	{"Stafford", 						1, 580, 50000},
	{"Stallion", 					   13, 439, 50000},
	{"Stratum", 					   14, 561, 50000},
//	{"Streak Trailer (train)", 			6, 570, 50000},
	{"Stretch", 						5, 409, 50000},
	{"Stuntplane", 						4, 513, 50000},
	{"Sultan", 							1, 560, 50000},
	{"Sunrise", 						1, 550, 50000},
	{"Super GT", 						2, 506, 50000},
	{"S.W.A.T.", 						3, 601, 50000},
	{"Sweeper", 						5, 574, 50000},
	{"Tahoma", 						   10, 566, 50000},
	{"Tampa", 							1, 549, 50000},
	{"Tanker", 							7, 514, 50000},
	{"Taxi", 							3, 420, 50000},
	{"Tornado", 					   10, 576, 50000},
	{"Towtruck", 						5, 525, 50000},
	{"Tractor", 						7, 531, 50000},
//	{"Tram", 							5, 449, 50000},
	{"Trashmaster", 					7, 408, 50000},
	{"Tropic", 						   12, 454, 50000},
	{"Tug", 							5, 583, 50000},
	{"Tug Stairs Trailer", 				6, 608, 50000},
	{"Turismo", 						2, 451, 50000},
	{"Uranus", 							2, 558, 50000},
	{"Utility Trailer", 				6, 611, 50000},
	{"Utility Van", 					7, 552, 50000},
	{"Vincent", 						1, 540, 50000},
	{"Virgo", 							1, 491, 50000},
	{"Voodoo", 						   10, 412, 50000},
	{"Vortex", 							5, 539, 50000},
	{"Walton", 							7, 478, 50000},
	{"Washington", 						1, 421, 50000},
	{"Wayfarer", 						9, 586, 50000},
	{"Willard", 						1, 529, 50000},
	{"Windsor", 					   13, 555, 50000},
    {"Yankee", 							7, 456, 50000},
    {"Yosemite", 						7, 554, 50000},
	{"ZR-350", 							2, 477, 50000}
};
And I have this to display data

Код:
  			if(listitem == 0) // Bikes
  		    {
				for (new i; i < sizeof(DScarBuy); i++)
				{
					if (DScarBuy[i][DSVehicleClass] == 9)
					{
					    new FirstCar[10];
						format(FirstCar, sizeof(FirstCar), "%i", DScarBuy[0][DSCarModel]);
						new spawnedcar = AddStaticVehicleEx(strval(FirstCar), 488.0754, -420.3091, 2757.9961, 358.6074, 1, 1, 3600);
						PutPlayerInVehicle(playerid, spawnedcar, 0);
						TogglePlayerControllable(playerid,0);
						if(prc_Moving[playerid] == false) // Check whether the camera is already set.
						{
							prc_Degree[playerid] = 0; // Reseting the variable
							prc_Timer[playerid] = SetTimerEx("MoveCamera", 75, true, "d", playerid); // Setting the timer
							prc_Moving[playerid] = true; // okay, now we're going to activate the moving variable
						}
					}
				}
			}
What I would like it to do is grab the first vehicle from class 9 so that would be the bf-900 because am going to make it so when you click arrows it despawns that vehicle and grabs the next in the list.

If someone could show me how to do that I would give them rep


Re: Help with selecting data - JessThompson - 30.08.2015

So what am asking is how would you be able to selected the first vehicle with the class 9 out of that list