21.12.2011, 04:33
pawn Код:
GetPlayerPos(playerid, x, y, z);
Object[playerid] = CreateObject(1525, x, y, z + 0.2, 0.0, 0.0, a + 90);
GetPlayerPos(playerid, x, y, z);
Object[playerid] = CreateObject(1525, x, y, z + 0.2, 0.0, 0.0, a + 90);
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{ // Created by ******
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid)) {
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
pawn Код:
Object[playerid] = CreateObject(1525, x, y, z + 0.2, 0.0, 0.0, a + 90); |
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else GetPlayerFacingAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return a;
}
GetPlayerPos(playerid, x, y, z);//This is important
GetXYInFrontOfPlayer(playerid,x,y,1.0);//Make sure this goes below GetPlayerPos (just so it overwrites X and Y because we'll be using Z)
Object[playerid] = CreateObject(1525, x, y, z + 0.2, 0.0, 0.0, a + 90);