05.06.2012, 09:25
pawn Код:
CMD:eveh(playerid, params[])
{
new vehid;
if(sscanf(params, "i", vehid)) SendClientMessage(playerid, Red, "Use: /eveh <car id>");
else
{
new
Float:x, Float:y, Float:z, Float: a;
GetPlayerFacingAngle(playerid, a);
//second parameter is distance, use negative velue to get pos behind playerid
GetXYZInFrontOfPlayer(playerid, 2, x, y, z);
CreateVehicle(vehid, x , y , z, a-180, 1,1, 60000);
CreateVehicle(vehid, x , y , z, a-180, 2,2, 60000);
GetXYZInFrontOfPlayer(playerid, 11, x, y, z);
CreateVehicle(vehid, x, y , z, a-180, 3,3, 60000);
CreateVehicle(vehid, x, y , z, a-180, 4,4, 60000);
GetXYZInFrontOfPlayer(playerid, 17, x, y, z);
CreateVehicle(vehid, x, y, z, a-180, 5,5, 60000);
CreateVehicle(vehid, x, y, z, a-180, 6,6, 60000);
}
return 1;
}
stock TE::GetXYZInFrontOfPlayer(playerid, Float:range, &Float:x, &Float:y, &Float:z)
{
new
Float:fPX, Float:fPY, Float:fPZ,
Float:fVX, Float:fVY, Float:fVZ;
GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
x = fPX + floatmul(fVX, range);
y = fPY + floatmul(fVY, range);
z = fPZ + floatmul(fVZ, range);
}

