Spawn vehicle. Didn't put me inside of the vehicle.
#2

Try this:

pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    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));
}

COMMAND:v(playerid, params[])
{
    new vehicle, pString[128], vCreated;
    if(sscanf(params, "i", vehicle)) return SendClientMessage(playerid, 0xFFFFFFFF, "* Usage: /v [vehicle id]");
    else
    {
        new Float: pPos[4];
        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
        GetPlayerFacingAngle(playerid, pPos[3]);
        GetXYInFrontOfPlayer(playerid, pPos[0], pPos[1], 5);
        format(pString, sizeof(pString), "* You have spawned a vehicle. ID: %i", vehicle);
        SendClientMessage(playerid, 0xFFFFFFFF, gMessage);
        vCreated = CreateVehicle(vehicle, pPos[0], pPos[1], pPos[2], pPos[3], random(128), random(128), -1);
                PutPlayerInVehicle(playerid, vCreated, 0);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)