17.07.2011, 10:33
Ok. So, i made it only for 8 cars per command. The command is /ccc or /createcirclecars.
This is the filterscript or the command:
Here's the screenshot:
If you don't like, I can make you like the cars to be spawned in a line. Like race cars ...
This is the filterscript or the command:
PHP Code:
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/createcirclecars",true) || !strcmp(cmdtext,"/ccc",true))
{
new numb = 8;
new Float:mypos[3],Float:hiscoord[3],Float:distance,Float:angle,Float:myangle;
GetPlayerFacingAngle(playerid,myangle);
GetPlayerPos(playerid,mypos[0],mypos[1],mypos[2]);
static const cars[8] =
{
411, 415, 429, 451, // Speed cars
550, 559, 560, 562 // Tunned cars
};
angle = 360.0 / numb;
distance = numb * 1.2;
new j = -1;
for(new i = 0; i < numb; i++)
{
j++;
hiscoord[0] = mypos[0] + distance * floatcos(j * angle,degrees);
hiscoord[1] = mypos[1] + distance * floatsin(j * angle,degrees);
new Float:vehangle;
if(!i || i == 4) vehangle = myangle;
else if(i == 1 || i == 5) vehangle = myangle+90;
else if(i == 2 || i == 6) vehangle = myangle+180;
else vehangle = myangle+270;
new carid = CreateVehicle(cars[random(sizeof(cars))], hiscoord[0], hiscoord[1], mypos[2], vehangle, -1, -1, 600);
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
}
return 1;
}
return 0;
}
If you don't like, I can make you like the cars to be spawned in a line. Like race cars ...