spawn car infront of me
#1

currently i have this:
Код:
X+6,Y,Z+1
But now it spawns left of me. But what's the correct coordinates to make it spawn infront of me?
Reply
#2

^^ awesome. Depending on where you currently look at - meaning whether you character faces north, south, west... whatever - the car will spawn left, right, behind or infront of you. Now think about that very carefully
Reply
#3

first of all you need to get player cordinates then you can only set items to spawn infront..

GetPlayerZangle or smth .. etc..
then
AddStaticVehicleEx(blablabla and with goten z angle)

Код:
new get;
get = GetPlayerZAngel ( or smth )
blablabla...

AddStaticVehicle/Ex(x+bla,y+bla+bla,z+bla,get+3 , blalbalba)
hope understood
Reply
#4

pawn Код:
forward Float:GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);
stock Float:GetXYInFrontOfPlayer(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;
}
Usage:
pawn Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z); // to get Z
GetXYInFrontOfPlayer(playerid,x,y,2.0);
CreateVehicle(blablabla X,Y,Z...);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)