new Float:RandomVehicles[][] = { {400}, {401}, {402}, {403}, {404}, {405}, {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {} << when all is added dont add "," }; public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/randomcar", cmdtext, true, 10) == 0) //randomcar is the command they'll be using to get car { new Random = random(sizeof(RandomVehicles)); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); CreateVehicle(Random, x, y, z, 90, -1, -1, 60); //CreateVehicle([vehicle id], [x position], [y position], [z position], [rotation], [car color 1 (-1 = random color)], [car color 2], [respawn time(seconds)] return 1; } return 0; }
#include a_samp
#include zcmd
#define MAX_RANDOM_VEHICLES ( 144 )
new AllCars[ MAX_RANDOM_VEHICLES ] = {
445,602,416,485,568,429,433,499,424,536,496,
504,422,609,498,401,575,518,402,541,482,431,
438,457,527,483,524,415,542,589,437,532,480,
596,599,597,598,578,486,507,562,585,427,419,
587,490,528,533,544,407,565,455,530,526,466,
604,492,474,588,434,502,503,494,579,545,411,
546,559,508,571,400,403,517,410,551,500,418,
572,423,414,516,582,467,443,470,404,514,603,
600,413,426,436,547,489,515,479,
534,505,442,440,475,543,605,495,567,428,
405,535,458,580,439,561,409,560,550,506,
574,566,549,420,459,576,525,531,406,583,451,
558,552,540,491,412,478,421,529,555,456,554,
477,406,556,444,573,539
},
PlayerVehicle[ MAX_PLAYERS ] = -1
;
CMD:spawncar( playerid, params[ ] )
{
new rand_car = random( MAX_RANDOM_VEHICLES - 1 ), s_car = AllCars[ rand_car ], interior = GetPlayerInterior( playerid ), Float:cPos[ 4 ];
// Get Player Position
GetPlayerPos( playerid, cPos[ 0 ], cPos[ 1 ], cPos[ 2 ] );
GetPlayerFacingAngle( playerid, cPos[ 3 ] );
// Destroy Last Vehicle
DestroyVehicle( PlayerVehicle[ playerid ] );
// Create Vehicle
PlayerVehicle[ playerid ] = AddStaticVehicleEx( s_car, cPos[ 0 ]+3, cPos[ 1 ], cPos[ 2 ], cPos[ 3 ], -1, -1, -1 );
// Set Vehicle Parameters
LinkVehicleToInterior( PlayerVehicle[ playerid ], interior );
SetVehicleNumberPlate( PlayerVehicle[ playerid ], "My Car" );
SetVehicleVirtualWorld( PlayerVehicle[ playerid ], GetPlayerVirtualWorld( playerid ) );
// Put Player in Vehicle
PutPlayerInVehicle( playerid, PlayerVehicle[ playerid ], 0 );
return ( 1 );
}
Код:
new Float:RandomVehicles[][] = { {400}, {401}, {402}, {403}, {404}, {405}, {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {}, << all car's id you want here {} << when all is added dont add "," }; public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/randomcar", cmdtext, true, 10) == 0) //randomcar is the command they'll be using to get car { new Random = random(sizeof(RandomVehicles)); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); CreateVehicle(Random, x, y, z, 90, -1, -1, 60); //CreateVehicle([vehicle id], [x position], [y position], [z position], [rotation], [car color 1 (-1 = random color)], [car color 2], [respawn time(seconds)] return 1; } return 0; } |
pawn Код:
|
//CMD:randomcar(playerid) ...
new rand = 399 + random(211);
CreateVehicle(rand, ........)
CMD:CreateCar(playerid, params[])
{
new rand = random(211) + 1 + 400;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(rand, x +5 , y + 5, z, 0, random(230), random(230), 0);
return 1;
}
pawn Код:
|