Last active
August 29, 2015 14:20
-
-
Save ziggi/c38eac3837de1b203743 to your computer and use it in GitHub Desktop.
GetCoordsBefore functions collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock GetCoordsBefore(Float:x, Float:y, Float:a, Float:distance, &Float:res_x, &Float:res_y) | |
{ | |
res_x = x + (distance * floatsin(-a, degrees)); | |
res_y = y + (distance * floatcos(-a, degrees)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock GetCoordsBeforeNPC(npcid, Float:distance, &Float:x, &Float:y) | |
{ | |
new Float:pos[4]; | |
FCNPC_GetPosition(npcid, pos[0], pos[1], pos[2]); | |
pos[3] = FCNPC_GetAngle(npcid); | |
GetCoordsBefore(pos[0], pos[1], pos[3], distance, x, y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock GetCoordsBeforePlayer(playerid, Float:distance, &Float:x, &Float:y) | |
{ | |
new Float:pos[4]; | |
GetPlayerPos(playerid, pos[0], pos[1], pos[2]); | |
GetPlayerFacingAngle(playerid, pos[3]); | |
GetCoordsBefore(pos[0], pos[1], pos[3], distance, x, y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock GetVehicleCoordsBeforePlayer(&Float:x, &Float:y, &Float:z, &Float:a, playerid, modelid = -1) | |
{ | |
new Float:size[3]; | |
if (modelid != -1) { | |
GetVehicleModelInfo(modelid, VEHICLE_MODEL_INFO_SIZE, size[0], size[1], size[2]); | |
} else { | |
size[0] = 1.5; | |
size[2] = 1.0; | |
} | |
GetPlayerPos(playerid, x, y, z); | |
GetPlayerFacingAngle(playerid, a); | |
GetCoordsBefore(x, y, a, size[0] + 0.5, x, y); | |
z -= size[2] * 0.25; | |
a += 90.0; | |
if (a > 360.0) { | |
a -= 360.0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment