http://forum.sa-mp.com/showpost.php?p=5 … ostcount=8
http://forum.sa-mp.com/showpost.php?p=6 … stcount=59
stock Float:GetAngleToPoint(Float:x1, Float:y1, Float:x2, Float:y2)
{
x2 -= x1;
y2 -= y1;
return floatabs(atan2(x2,y2)-180.0);
}
stock GetPlayerCameraLookAt(playerid, &Float:X, &Float:Y, &Float:Z)
{
new
Float:CamX, Float:CamY, Float:CamZ,
Float:FrX, Float:FrY, Float:FrZ;
GetPlayerCameraPos(playerid, CamX, CamY, CamZ);
GetPlayerCameraFrontVector(playerid, FrX, FrY, FrZ);
X = FrX + CamX;
Y = FrY + CamY;
Z = FrZ + CamZ;
}
stock removePlayerFromVehicle ( playerid )
{
if ( !IsPlayerInAnyVehicle(playerid) ) return 0;
new vid = GetPlayerVehicleID(playerid);
if ( vid == INVALID_VEHICLE_ID ) return 0;
new Float: pos[4], Float: sideAngle;
GetVehiclePos ( vid, pos[0], pos[1], pos[2] );
GetVehicleZAngle( vid, pos[3] );
switch ( GetPlayerVehicleSeat(playerid) )
{
case 0,2 : sideAngle = pos[3] - 180.0;
default : sideAngle = pos[3];
}
SetPlayerPos( playerid,
pos[0] + 2.0 * floatcos( sideAngle, degrees ),
pos[1] + 2.0 * floatsin( sideAngle, degrees ),
pos[2] + 0.3 );
SetPlayerFacingAngle( playerid, pos[3] );
SetCameraBehindPlayer(playerid);
return 1;
}
stock GetVehicleMaxPassengers(iModel)
{
if(400 <= iModel <= 611)
{
static
s_MaxPassengers[] =
{
271782163, 288428337, 288559891, -2146225407, 327282960, 271651075, 268443408, 286339857, 319894289, 823136512, 805311233,
285414161, 286331697, 268513553, 18026752, 286331152, 286261297, 286458129, 856765201, 286331137, 856690995, 269484528,
51589393, -15658689, 322109713, -15527663, 65343
}
;
return ((s_MaxPassengers[(iModel -= 400) >>> 3] >>> ((iModel & 7) << 2)) & 0xF);
}
return 0xF;
}